- Fix C++ version of BM_REQUEST_TYPE without breaking the C version

svn path=/trunk/; revision=75002
This commit is contained in:
Thomas Faber 2017-06-11 12:26:48 +00:00
parent b8ea78efa1
commit b8ed811f40
3 changed files with 15 additions and 11 deletions

View file

@ -55,12 +55,16 @@ typedef enum _USB_DEVICE_SPEED {
typedef union _BM_REQUEST_TYPE {
#ifdef __cplusplus
struct {
#else
struct _BM {
#endif
UCHAR Recipient:2;
UCHAR Reserved:3;
UCHAR Type:2;
UCHAR Dir:1;
} _BM;
};
UCHAR B;
} BM_REQUEST_TYPE, *PBM_REQUEST_TYPE;

View file

@ -1426,8 +1426,8 @@ CHubController::HandleClassDevice(
// generate setup packet
//
CtrlSetup.bmRequestType.B = 0;
CtrlSetup.bmRequestType._BM.Recipient = BMREQUEST_TO_DEVICE;
CtrlSetup.bmRequestType._BM.Type = BMREQUEST_CLASS;
CtrlSetup.bmRequestType.Recipient = BMREQUEST_TO_DEVICE;
CtrlSetup.bmRequestType.Type = BMREQUEST_CLASS;
CtrlSetup.bRequest = Urb->UrbControlVendorClassRequest.Request;
CtrlSetup.wValue.W = Urb->UrbControlVendorClassRequest.Value;
CtrlSetup.wIndex.W = Urb->UrbControlVendorClassRequest.Index;
@ -1438,7 +1438,7 @@ CHubController::HandleClassDevice(
//
// data direction is device to host
//
CtrlSetup.bmRequestType._BM.Dir = BMREQUEST_DEVICE_TO_HOST;
CtrlSetup.bmRequestType.Dir = BMREQUEST_DEVICE_TO_HOST;
}
//
@ -1889,8 +1889,8 @@ CHubController::HandleVendorDevice(
// initialize setup packet
//
CtrlSetup.bmRequestType.B = 0;
CtrlSetup.bmRequestType._BM.Recipient = BMREQUEST_TO_DEVICE;
CtrlSetup.bmRequestType._BM.Type = BMREQUEST_VENDOR;
CtrlSetup.bmRequestType.Recipient = BMREQUEST_TO_DEVICE;
CtrlSetup.bmRequestType.Type = BMREQUEST_VENDOR;
CtrlSetup.bRequest = Urb->UrbControlVendorClassRequest.Request;
CtrlSetup.wValue.W = Urb->UrbControlVendorClassRequest.Value;
CtrlSetup.wIndex.W = Urb->UrbControlVendorClassRequest.Index;
@ -1901,7 +1901,7 @@ CHubController::HandleVendorDevice(
//
// data direction is device to host
//
CtrlSetup.bmRequestType._BM.Dir = BMREQUEST_DEVICE_TO_HOST;
CtrlSetup.bmRequestType.Dir = BMREQUEST_DEVICE_TO_HOST;
}
//

View file

@ -698,10 +698,10 @@ CUSBDevice::GetConfigurationDescriptor(
//
// build setup packet
//
CtrlSetup.bmRequestType._BM.Recipient = BMREQUEST_TO_DEVICE;
CtrlSetup.bmRequestType._BM.Type = BMREQUEST_STANDARD;
CtrlSetup.bmRequestType._BM.Reserved = 0;
CtrlSetup.bmRequestType._BM.Dir = BMREQUEST_DEVICE_TO_HOST;
CtrlSetup.bmRequestType.Recipient = BMREQUEST_TO_DEVICE;
CtrlSetup.bmRequestType.Type = BMREQUEST_STANDARD;
CtrlSetup.bmRequestType.Reserved = 0;
CtrlSetup.bmRequestType.Dir = BMREQUEST_DEVICE_TO_HOST;
CtrlSetup.bRequest = USB_REQUEST_GET_DESCRIPTOR;
CtrlSetup.wValue.LowByte = ConfigurationIndex;
CtrlSetup.wValue.HiByte = USB_CONFIGURATION_DESCRIPTOR_TYPE;