X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=target_firmware%2Fmagpie_fw_dev%2Ftarget%2Fhif%2Fk2_fw_usb_api.c;h=7d4c4fff0576f0083b557ad2c085e3af1ed773eb;hb=bad9dc61f8a3c4762db989f5897a3a672a5405df;hp=83a72a94de7762b7f0c6bb0cd7b55a1bf8d301d8;hpb=dbbb809d592dde0b3c9ecb97b3b387ff8e40e799;p=open-ath9k-htc-firmware.git diff --git a/target_firmware/magpie_fw_dev/target/hif/k2_fw_usb_api.c b/target_firmware/magpie_fw_dev/target/hif/k2_fw_usb_api.c index 83a72a9..7d4c4ff 100755 --- a/target_firmware/magpie_fw_dev/target/hif/k2_fw_usb_api.c +++ b/target_firmware/magpie_fw_dev/target/hif/k2_fw_usb_api.c @@ -715,13 +715,18 @@ ERR_DONE: ; } +extern uint16_t *u8UsbDeviceDescriptor; extern uint16_t *u8ConfigDescriptorEX; extern uint16_t *pu8DescriptorEX; extern uint16_t u16TxRxCounter; extern BOOLEAN bGet_descriptor(void); +uint16_t DeviceDescriptorPatch[9]; uint16_t ConfigDescriptorPatch[30]; + +#define BCD_DEVICE 6 +#define BCD_DEVICE_FW_SIGNATURE 0xffff #define EP3_TRANSFER_TYPE_OFFSET 17 #define EP3_INT_INTERVAL 19 #define EP4_TRANSFER_TYPE_OFFSET 21 @@ -729,19 +734,23 @@ uint16_t ConfigDescriptorPatch[30]; BOOLEAN bGet_descriptor_patch(void) { - if (mDEV_REQ_VALUE_HIGH() == 2) { - uint8_t *p = (uint8_t *)u8ConfigDescriptorEX; + int i; + switch (mDEV_REQ_VALUE_HIGH()) { + case 1: + ath_hal_memcpy(DeviceDescriptorPatch, + u8UsbDeviceDescriptor, sizeof(DeviceDescriptorPatch)); - /* Copy ConfigDescriptor */ - ath_hal_memcpy(ConfigDescriptorPatch, p, sizeof(ConfigDescriptorPatch)); + DeviceDescriptorPatch[BCD_DEVICE] = BCD_DEVICE_FW_SIGNATURE; - p = (uint8_t *)ConfigDescriptorPatch; + pu8DescriptorEX = DeviceDescriptorPatch; + u16TxRxCounter = mTABLE_LEN(DeviceDescriptorPatch[0]); + break; + case 2: + /* Copy ConfigDescriptor */ + ath_hal_memcpy(ConfigDescriptorPatch, + u8ConfigDescriptorEX, sizeof(ConfigDescriptorPatch)); - /* Patch the transfer type of EP3 and EP4 */ - ConfigDescriptorPatch[EP3_TRANSFER_TYPE_OFFSET] = 0x0283; - ConfigDescriptorPatch[EP3_INT_INTERVAL] = 0x0700; - ConfigDescriptorPatch[EP4_TRANSFER_TYPE_OFFSET] = 0x4002; - ConfigDescriptorPatch[EP4_INT_INTERVAL] = 0x00; + /* place holder for EPx patches */ switch (mDEV_REQ_VALUE_LOW()) { @@ -753,16 +762,16 @@ BOOLEAN bGet_descriptor_patch(void) default: return FALSE; } - - if (u16TxRxCounter > mDEV_REQ_LENGTH()) - u16TxRxCounter = mDEV_REQ_LENGTH(); - - A_USB_EP0_TX_DATA(); - return TRUE; - } - else { + break; + default: return bGet_descriptor(); } + + if (u16TxRxCounter > mDEV_REQ_LENGTH()) + u16TxRxCounter = mDEV_REQ_LENGTH(); + + A_USB_EP0_TX_DATA(); + return TRUE; } extern BOOLEAN bStandardCommand(void);