mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Moved PID and VID readings
This commit is contained in:
parent
b76ddedd59
commit
90dba71937
2 changed files with 5 additions and 6 deletions
9
BTD.cpp
9
BTD.cpp
|
@ -101,6 +101,9 @@ uint8_t BTD::ConfigureDevice(uint8_t parent, uint8_t port, bool lowspeed) {
|
|||
epInfo[0].maxPktSize = (uint8_t)((USB_DEVICE_DESCRIPTOR*)buf)->bMaxPacketSize0; // Extract Max Packet Size from device descriptor
|
||||
epInfo[1].epAddr = ((USB_DEVICE_DESCRIPTOR*)buf)->bNumConfigurations; // Steal and abuse from epInfo structure to save memory
|
||||
|
||||
VID = ((USB_DEVICE_DESCRIPTOR*)buf)->idVendor;
|
||||
PID = ((USB_DEVICE_DESCRIPTOR*)buf)->idProduct;
|
||||
|
||||
return USB_ERROR_CONFIG_REQUIRES_ADDITIONAL_RESET;
|
||||
|
||||
FailGetDevDescr:
|
||||
|
@ -113,12 +116,9 @@ FailGetDevDescr:
|
|||
};
|
||||
|
||||
uint8_t BTD::Init(uint8_t parent, uint8_t port, bool lowspeed) {
|
||||
uint8_t buf[sizeof (USB_DEVICE_DESCRIPTOR)];
|
||||
uint8_t rcode;
|
||||
uint8_t num_of_conf = epInfo[1].epAddr; // Number of configurations
|
||||
epInfo[1].epAddr = 0;
|
||||
uint16_t PID;
|
||||
uint16_t VID;
|
||||
|
||||
AddressPool &addrPool = pUsb->GetAddressPool();
|
||||
#ifdef EXTRADEBUG
|
||||
|
@ -165,9 +165,6 @@ uint8_t BTD::Init(uint8_t parent, uint8_t port, bool lowspeed) {
|
|||
if (rcode)
|
||||
goto FailSetDevTblEntry;
|
||||
|
||||
VID = ((USB_DEVICE_DESCRIPTOR*)buf)->idVendor;
|
||||
PID = ((USB_DEVICE_DESCRIPTOR*)buf)->idProduct;
|
||||
|
||||
if (VID == PS3_VID && (PID == PS3_PID || PID == PS3NAVIGATION_PID || PID == PS3MOVE_PID)) {
|
||||
rcode = pUsb->setConf(bAddress, epInfo[ BTD_CONTROL_PIPE ].epAddr, 1); // We only need the Control endpoint, so we don't have to initialize the other endpoints of device
|
||||
if (rcode)
|
||||
|
|
2
BTD.h
2
BTD.h
|
@ -466,6 +466,8 @@ private:
|
|||
void clearAllVariables(); // Set all variables, endpoint structs etc. to default values
|
||||
BluetoothService* btService[BTD_NUMSERVICES];
|
||||
|
||||
uint16_t PID, VID; // PID and VID of device connected
|
||||
|
||||
bool bPollEnable;
|
||||
uint8_t pollInterval;
|
||||
|
||||
|
|
Loading…
Reference in a new issue