Moved PID and VID readings

This commit is contained in:
Kristian Sloth Lauszus 2013-10-07 01:45:21 +02:00
parent b76ddedd59
commit 90dba71937
2 changed files with 5 additions and 6 deletions

View file

@ -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
View file

@ -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;