diff options
author | Amir Hammad <amir.hammad@hotmail.com> | 2016-08-30 04:02:27 +0200 |
---|---|---|
committer | Amir Hammad <amir.hammad@hotmail.com> | 2016-09-01 10:36:36 +0200 |
commit | 3493c1c0878db2b2c367fcdd9e69e4dcc104cad6 (patch) | |
tree | 308ec7c06a38b8036e3ffda1cddc6cd429f4de81 /src | |
parent | 5615b9c938f6e4d05f7fae68b5329346df1238f9 (diff) | |
download | secure-hid-3493c1c0878db2b2c367fcdd9e69e4dcc104cad6.tar.gz secure-hid-3493c1c0878db2b2c367fcdd9e69e4dcc104cad6.tar.bz2 secure-hid-3493c1c0878db2b2c367fcdd9e69e4dcc104cad6.zip |
fix bmRequestType field - use of defines
Signed-off-by: Amir Hammad <amir.hammad@hotmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/usbh_core.c | 8 | ||||
-rw-r--r-- | src/usbh_driver_ac_midi.c | 2 | ||||
-rw-r--r-- | src/usbh_driver_gp_xbox.c | 2 | ||||
-rw-r--r-- | src/usbh_driver_hub.c | 24 |
4 files changed, 18 insertions, 18 deletions
diff --git a/src/usbh_core.c b/src/usbh_core.c index e1076cd..5e35da9 100644 --- a/src/usbh_core.c +++ b/src/usbh_core.c @@ -337,7 +337,7 @@ static void device_enumerate(usbh_device_t *dev, usbh_packet_callback_data_t cb_ struct usb_setup_data setup_data; - setup_data.bmRequestType = 0b10000000; + setup_data.bmRequestType = USB_REQ_TYPE_IN | USB_REQ_TYPE_STANDARD | USB_REQ_TYPE_DEVICE; setup_data.bRequest = USB_REQ_GET_DESCRIPTOR; setup_data.wValue = USB_DT_DEVICE << 8; setup_data.wIndex = 0; @@ -394,7 +394,7 @@ static void device_enumerate(usbh_device_t *dev, usbh_packet_callback_data_t cb_ dev->packet_size_max0 = ddt->bMaxPacketSize0; struct usb_setup_data setup_data; - setup_data.bmRequestType = 0b10000000; + setup_data.bmRequestType = USB_REQ_TYPE_IN | USB_REQ_TYPE_STANDARD | USB_REQ_TYPE_DEVICE; setup_data.bRequest = USB_REQ_GET_DESCRIPTOR; setup_data.wValue = USB_DT_CONFIGURATION << 8; setup_data.wIndex = 0; @@ -457,7 +457,7 @@ static void device_enumerate(usbh_device_t *dev, usbh_packet_callback_data_t cb_ (struct usb_config_descriptor *)&usbh_buffer[USB_DT_DEVICE_SIZE]; struct usb_setup_data setup_data; LOG_PRINTF("WRITE: LEN: %d", cdt->wTotalLength); - setup_data.bmRequestType = 0b10000000; + setup_data.bmRequestType = USB_REQ_TYPE_IN | USB_REQ_TYPE_STANDARD | USB_REQ_TYPE_DEVICE; setup_data.bRequest = USB_REQ_GET_DESCRIPTOR; setup_data.wValue = USB_DT_CONFIGURATION << 8; setup_data.wIndex = 0; @@ -573,7 +573,7 @@ void device_enumeration_start(usbh_device_t *dev) struct usb_setup_data setup_data; - setup_data.bmRequestType = 0b00000000; + setup_data.bmRequestType = USB_REQ_TYPE_STANDARD | USB_REQ_TYPE_DEVICE; setup_data.bRequest = USB_REQ_SET_ADDRESS; setup_data.wValue = address; setup_data.wIndex = 0; diff --git a/src/usbh_driver_ac_midi.c b/src/usbh_driver_ac_midi.c index 413875f..205c2a2 100644 --- a/src/usbh_driver_ac_midi.c +++ b/src/usbh_driver_ac_midi.c @@ -300,7 +300,7 @@ static void midi_poll(void *drvdata, uint32_t t_us) //~ LOG_PRINTF("CFGVAL: %d\n", dev->config_val); struct usb_setup_data setup_data; - setup_data.bmRequestType = 0b00000000; + setup_data.bmRequestType = USB_REQ_TYPE_STANDARD | USB_REQ_TYPE_DEVICE; setup_data.bRequest = USB_REQ_SET_CONFIGURATION; setup_data.wValue = midi->buffer[0]; setup_data.wIndex = 0; diff --git a/src/usbh_driver_gp_xbox.c b/src/usbh_driver_gp_xbox.c index 01cebb5..1bc2498 100644 --- a/src/usbh_driver_gp_xbox.c +++ b/src/usbh_driver_gp_xbox.c @@ -364,7 +364,7 @@ static void poll(void *drvdata, uint32_t time_curr_us) { struct usb_setup_data setup_data; - setup_data.bmRequestType = 0b00000000; + setup_data.bmRequestType = USB_REQ_TYPE_STANDARD | USB_REQ_TYPE_DEVICE; setup_data.bRequest = USB_REQ_SET_CONFIGURATION; setup_data.wValue = gp_xbox->configuration_value; setup_data.wIndex = 0; diff --git a/src/usbh_driver_hub.c b/src/usbh_driver_hub.c index a7448f5..29335a7 100644 --- a/src/usbh_driver_hub.c +++ b/src/usbh_driver_hub.c @@ -179,9 +179,9 @@ static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data) struct usb_setup_data setup_data;
// If regular port event, else hub event
if (port) {
- setup_data.bmRequestType = 0b10100011;
+ setup_data.bmRequestType = USB_REQ_TYPE_IN | USB_REQ_TYPE_CLASS | USB_REQ_TYPE_INTERFACE | USB_REQ_TYPE_ENDPOINT;
} else {
- setup_data.bmRequestType = 0b10100000;
+ setup_data.bmRequestType = USB_REQ_TYPE_IN | USB_REQ_TYPE_CLASS | USB_REQ_TYPE_DEVICE;
}
setup_data.bRequest = USB_REQ_GET_STATUS;
@@ -246,7 +246,7 @@ static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data) struct usb_setup_data setup_data;
hub->desc_len = hub->device[0]->packet_size_max0;
- setup_data.bmRequestType = 0b10100000;
+ setup_data.bmRequestType = USB_REQ_TYPE_IN | USB_REQ_TYPE_CLASS | USB_REQ_TYPE_DEVICE;
setup_data.bRequest = USB_REQ_GET_DESCRIPTOR;
setup_data.wValue = 0x29<<8;
setup_data.wIndex = 0;
@@ -297,7 +297,7 @@ static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data) struct usb_setup_data setup_data;
hub->desc_len = hub_descriptor->head.bDescLength;
- setup_data.bmRequestType = 0b10100000;
+ setup_data.bmRequestType = USB_REQ_TYPE_IN | USB_REQ_TYPE_CLASS | USB_REQ_TYPE_DEVICE;
setup_data.bRequest = USB_REQ_GET_DESCRIPTOR;
setup_data.wValue = 0x29<<8;
setup_data.wIndex = 0;
@@ -361,7 +361,7 @@ static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data) struct usb_setup_data setup_data;
LOG_PRINTF("[!%d!]",hub->index);
- setup_data.bmRequestType = 0b00100011;
+ setup_data.bmRequestType = USB_REQ_TYPE_CLASS | USB_REQ_TYPE_INTERFACE | USB_REQ_TYPE_ENDPOINT;
setup_data.bRequest = HUB_REQ_SET_FEATURE;
setup_data.wValue = HUB_FEATURE_PORT_POWER;
setup_data.wIndex = hub->index;
@@ -400,7 +400,7 @@ static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data) {
struct usb_setup_data setup_data;
- setup_data.bmRequestType = 0b10100000;
+ setup_data.bmRequestType = USB_REQ_TYPE_IN | USB_REQ_TYPE_CLASS | USB_REQ_TYPE_DEVICE;
setup_data.bRequest = USB_REQ_GET_STATUS;
setup_data.wValue = 0;
setup_data.wIndex = 0;
@@ -445,7 +445,7 @@ static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data) {
struct usb_setup_data setup_data;
- setup_data.bmRequestType = 0b10100011;
+ setup_data.bmRequestType = USB_REQ_TYPE_IN | USB_REQ_TYPE_CLASS | USB_REQ_TYPE_INTERFACE | USB_REQ_TYPE_ENDPOINT;
setup_data.bRequest = USB_REQ_GET_STATUS;
setup_data.wValue = 0;
setup_data.wIndex = ++hub->index;
@@ -564,7 +564,7 @@ static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data) // clear feature C_PORT_CONNECTION
struct usb_setup_data setup_data;
- setup_data.bmRequestType = 0b00100011;
+ setup_data.bmRequestType = USB_REQ_TYPE_CLASS | USB_REQ_TYPE_INTERFACE | USB_REQ_TYPE_ENDPOINT;
setup_data.bRequest = HUB_REQ_CLEAR_FEATURE;
setup_data.wValue = HUB_FEATURE_C_PORT_CONNECTION;
setup_data.wIndex = port;
@@ -580,7 +580,7 @@ static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data) // Reset processing is complete, enumerate device
struct usb_setup_data setup_data;
- setup_data.bmRequestType = 0b00100011;
+ setup_data.bmRequestType = USB_REQ_TYPE_CLASS | USB_REQ_TYPE_INTERFACE | USB_REQ_TYPE_ENDPOINT;
setup_data.bRequest = HUB_REQ_CLEAR_FEATURE;
setup_data.wValue = HUB_FEATURE_C_PORT_RESET;
setup_data.wIndex = port;
@@ -622,7 +622,7 @@ static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data) if ((stc) & (1<<HUB_FEATURE_PORT_CONNECTION)) {
struct usb_setup_data setup_data;
- setup_data.bmRequestType = 0b00100011;
+ setup_data.bmRequestType = USB_REQ_TYPE_CLASS | USB_REQ_TYPE_INTERFACE | USB_REQ_TYPE_ENDPOINT;
setup_data.bRequest = HUB_REQ_SET_FEATURE;
setup_data.wValue = HUB_FEATURE_PORT_RESET;
setup_data.wIndex = port;
@@ -687,7 +687,7 @@ static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data) // Disable Low speed device immediately
struct usb_setup_data setup_data;
- setup_data.bmRequestType = 0b00100011;
+ setup_data.bmRequestType = USB_REQ_TYPE_CLASS | USB_REQ_TYPE_INTERFACE | USB_REQ_TYPE_ENDPOINT;
setup_data.bRequest = HUB_REQ_CLEAR_FEATURE;
setup_data.wValue = HUB_FEATURE_PORT_ENABLE;
setup_data.wIndex = port;
@@ -782,7 +782,7 @@ static void poll(void *drvdata, uint32_t time_curr_us) LOG_PRINTF("CFGVAL: %d\n", hub->buffer[0]);
struct usb_setup_data setup_data;
- setup_data.bmRequestType = 0b00000000;
+ setup_data.bmRequestType = USB_REQ_TYPE_STANDARD | USB_REQ_TYPE_DEVICE;
setup_data.bRequest = USB_REQ_SET_CONFIGURATION;
setup_data.wValue = hub->buffer[0];
setup_data.wIndex = 0;
|