Fork to support Mouse boot protocol and steam controllers.
Fork of USBHOST by
Diff: USBHostHID/USBHostSteamController.cpp
- Revision:
- 10:89cf0de5f793
- Parent:
- 9:6bbea1ccc9f8
diff -r 6bbea1ccc9f8 -r 89cf0de5f793 USBHostHID/USBHostSteamController.cpp --- a/USBHostHID/USBHostSteamController.cpp Sun Aug 20 13:55:46 2017 +0000 +++ b/USBHostHID/USBHostSteamController.cpp Mon Aug 21 21:22:41 2017 +0000 @@ -33,8 +33,8 @@ onZUpdate = NULL; report_id = 0; dev_connected = false; - mouse_device_found = false; - mouse_intf = -1; + steam_device_found = false; + steam_intf = -1; buttons = 0; x = 0; @@ -62,19 +62,19 @@ if(host->enumerate(dev, this)) break; - if (mouse_device_found) { + if (steam_device_found) { { printf("found!"); /* As this is done in a specific thread * this lock is taken to avoid to process the device * disconnect in usb process during the device registering */ USBHost::Lock Lock(host); - int_in = dev->getEndpoint(mouse_intf, INTERRUPT_ENDPOINT, IN); + int_in = dev->getEndpoint(steam_intf, INTERRUPT_ENDPOINT, IN); if (!int_in) break; - USB_INFO("New SteamController device: VID:%04x PID:%04x [dev: %p - intf: %d]", dev->getVid(), dev->getPid(), dev, mouse_intf); - dev->setName("Steam", mouse_intf); - host->registerDriver(dev, mouse_intf, this, &USBHostSteamController::init); + USB_INFO("New SteamController device: VID:%04x PID:%04x [dev: %p - intf: %d]", dev->getVid(), dev->getPid(), dev, steam_intf); + dev->setName("Steam", steam_intf); + host->registerDriver(dev, steam_intf, this, &USBHostSteamController::init); int_in->attach(this, &USBHostSteamController::rxHandler); len_listen = int_in->getSize(); @@ -165,13 +165,13 @@ /*virtual*/ bool USBHostSteamController::parseInterface(uint8_t intf_nb, uint8_t intf_class, uint8_t intf_subclass, uint8_t intf_protocol) //Must return true if the interface should be parsed { - printf("intf_nb %d (%d) intf_class %x intf_subclass %x intf_protocol %x\r\n", intf_nb, mouse_intf, intf_class,intf_subclass, intf_protocol); + //printf("intf_nb %d (%d) intf_class %x intf_subclass %x intf_protocol %x\r\n", intf_nb, steam_intf, intf_class,intf_subclass, intf_protocol); - if ((mouse_intf == -1) && + if ((steam_intf == -1) && (intf_class == HID_CLASS) && (intf_subclass == 0x00) && (intf_protocol == 0x00)) { - mouse_intf = intf_nb; + steam_intf = intf_nb; printf("true!"); return true; @@ -181,9 +181,9 @@ /*virtual*/ bool USBHostSteamController::useEndpoint(uint8_t intf_nb, ENDPOINT_TYPE type, ENDPOINT_DIRECTION dir) //Must return true if the endpoint will be used { - if (intf_nb == mouse_intf) { + if (intf_nb == steam_intf) { if (type == INTERRUPT_ENDPOINT && dir == IN) { - mouse_device_found = true; + steam_device_found = true; return true; } }