USB: Add initialization checks to Pipe usages of Device.
Complements the ones added earlier to the module itself. Should fix the panic portion of #15115.
This commit is contained in:
@@ -82,7 +82,11 @@ status_t
|
|||||||
Pipe::SetFeature(uint16 selector)
|
Pipe::SetFeature(uint16 selector)
|
||||||
{
|
{
|
||||||
TRACE("set feature %u\n", selector);
|
TRACE("set feature %u\n", selector);
|
||||||
return ((Device *)Parent())->DefaultPipe()->SendRequest(
|
Device *device = (Device *)Parent();
|
||||||
|
if (device->InitCheck() != B_OK)
|
||||||
|
return B_NO_INIT;
|
||||||
|
|
||||||
|
return device->DefaultPipe()->SendRequest(
|
||||||
USB_REQTYPE_STANDARD | USB_REQTYPE_ENDPOINT_OUT,
|
USB_REQTYPE_STANDARD | USB_REQTYPE_ENDPOINT_OUT,
|
||||||
USB_REQUEST_SET_FEATURE,
|
USB_REQUEST_SET_FEATURE,
|
||||||
selector,
|
selector,
|
||||||
@@ -98,12 +102,16 @@ Pipe::SetFeature(uint16 selector)
|
|||||||
status_t
|
status_t
|
||||||
Pipe::ClearFeature(uint16 selector)
|
Pipe::ClearFeature(uint16 selector)
|
||||||
{
|
{
|
||||||
|
Device *device = (Device *)Parent();
|
||||||
|
if (device->InitCheck() != B_OK)
|
||||||
|
return B_NO_INIT;
|
||||||
|
|
||||||
// clearing a stalled condition resets the data toggle
|
// clearing a stalled condition resets the data toggle
|
||||||
if (selector == USB_FEATURE_ENDPOINT_HALT)
|
if (selector == USB_FEATURE_ENDPOINT_HALT)
|
||||||
SetDataToggle(false);
|
SetDataToggle(false);
|
||||||
|
|
||||||
TRACE("clear feature %u\n", selector);
|
TRACE("clear feature %u\n", selector);
|
||||||
return ((Device *)Parent())->DefaultPipe()->SendRequest(
|
return device->DefaultPipe()->SendRequest(
|
||||||
USB_REQTYPE_STANDARD | USB_REQTYPE_ENDPOINT_OUT,
|
USB_REQTYPE_STANDARD | USB_REQTYPE_ENDPOINT_OUT,
|
||||||
USB_REQUEST_CLEAR_FEATURE,
|
USB_REQUEST_CLEAR_FEATURE,
|
||||||
selector,
|
selector,
|
||||||
@@ -120,7 +128,11 @@ status_t
|
|||||||
Pipe::GetStatus(uint16 *status)
|
Pipe::GetStatus(uint16 *status)
|
||||||
{
|
{
|
||||||
TRACE("get status\n");
|
TRACE("get status\n");
|
||||||
return ((Device *)Parent())->DefaultPipe()->SendRequest(
|
Device *device = (Device *)Parent();
|
||||||
|
if (device->InitCheck() != B_OK)
|
||||||
|
return B_NO_INIT;
|
||||||
|
|
||||||
|
return device->DefaultPipe()->SendRequest(
|
||||||
USB_REQTYPE_STANDARD | USB_REQTYPE_ENDPOINT_IN,
|
USB_REQTYPE_STANDARD | USB_REQTYPE_ENDPOINT_IN,
|
||||||
USB_REQUEST_GET_STATUS,
|
USB_REQUEST_GET_STATUS,
|
||||||
0,
|
0,
|
||||||
|
|||||||
Reference in New Issue
Block a user