mirror of
https://github.com/CTCaer/hekate.git
synced 2024-11-23 02:16:41 +00:00
usb: Move lang/serial descriptors to header
This commit is contained in:
parent
e45ffab5d8
commit
6a4161fdc4
2 changed files with 22 additions and 16 deletions
|
@ -228,6 +228,8 @@ typedef struct _usb_desc_t
|
||||||
usb_dev_bot_t *dev_bot;
|
usb_dev_bot_t *dev_bot;
|
||||||
u8 *vendor;
|
u8 *vendor;
|
||||||
u8 *product;
|
u8 *product;
|
||||||
|
u8 *serial;
|
||||||
|
u8 *lang_id;
|
||||||
usb_ms_os_descr_t *ms_os;
|
usb_ms_os_descr_t *ms_os;
|
||||||
usb_ms_cid_descr_t *ms_cid;
|
usb_ms_cid_descr_t *ms_cid;
|
||||||
usb_ms_ext_prop_descr_t *mx_ext;
|
usb_ms_ext_prop_descr_t *mx_ext;
|
||||||
|
@ -369,6 +371,19 @@ usb_dev_bot_t usb_device_binary_object_descriptor =
|
||||||
.wU2DevExitLat = 0
|
.wU2DevExitLat = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
u8 usb_lang_id_string_descriptor[4] =
|
||||||
|
{
|
||||||
|
4, 3,
|
||||||
|
0x09, 0x04
|
||||||
|
};
|
||||||
|
|
||||||
|
u8 usb_serial_string_descriptor[26] =
|
||||||
|
{
|
||||||
|
26, 0x03,
|
||||||
|
'C', 0x00, '7', 0x00, 'C', 0x00, '0', 0x00,
|
||||||
|
'9', 0x00, '2', 0x00, '4', 0x00, '2', 0x00, 'F', 0x00, '7', 0x00, '0', 0x00, '3', 0x00
|
||||||
|
};
|
||||||
|
|
||||||
u8 usb_vendor_string_descriptor_ums[32] =
|
u8 usb_vendor_string_descriptor_ums[32] =
|
||||||
{
|
{
|
||||||
26, 0x03,
|
26, 0x03,
|
||||||
|
@ -716,6 +731,8 @@ usb_desc_t usb_gadget_ums_descriptors =
|
||||||
.dev_bot = &usb_device_binary_object_descriptor,
|
.dev_bot = &usb_device_binary_object_descriptor,
|
||||||
.vendor = usb_vendor_string_descriptor_ums,
|
.vendor = usb_vendor_string_descriptor_ums,
|
||||||
.product = usb_product_string_descriptor_ums,
|
.product = usb_product_string_descriptor_ums,
|
||||||
|
.serial = usb_serial_string_descriptor,
|
||||||
|
.lang_id = usb_lang_id_string_descriptor,
|
||||||
.ms_os = &usb_ms_os_descriptor,
|
.ms_os = &usb_ms_os_descriptor,
|
||||||
.ms_cid = &usb_ms_cid_descriptor,
|
.ms_cid = &usb_ms_cid_descriptor,
|
||||||
.mx_ext = &usb_ms_ext_prop_descriptor_ums
|
.mx_ext = &usb_ms_ext_prop_descriptor_ums
|
||||||
|
@ -730,6 +747,8 @@ usb_desc_t usb_gadget_hid_jc_descriptors =
|
||||||
.dev_bot = &usb_device_binary_object_descriptor,
|
.dev_bot = &usb_device_binary_object_descriptor,
|
||||||
.vendor = usb_vendor_string_descriptor_hid,
|
.vendor = usb_vendor_string_descriptor_hid,
|
||||||
.product = usb_product_string_descriptor_hid_jc,
|
.product = usb_product_string_descriptor_hid_jc,
|
||||||
|
.serial = usb_serial_string_descriptor,
|
||||||
|
.lang_id = usb_lang_id_string_descriptor,
|
||||||
.ms_os = &usb_ms_os_descriptor,
|
.ms_os = &usb_ms_os_descriptor,
|
||||||
.ms_cid = &usb_ms_cid_descriptor,
|
.ms_cid = &usb_ms_cid_descriptor,
|
||||||
.mx_ext = &usb_ms_ext_prop_descriptor_hid
|
.mx_ext = &usb_ms_ext_prop_descriptor_hid
|
||||||
|
|
|
@ -188,19 +188,6 @@ typedef struct _usbd_controller_t
|
||||||
bool charger_detect;
|
bool charger_detect;
|
||||||
} usbd_controller_t;
|
} usbd_controller_t;
|
||||||
|
|
||||||
u8 usb_serial_string_descriptor[26] =
|
|
||||||
{
|
|
||||||
26, 0x03,
|
|
||||||
'C', 0x00, '7', 0x00, 'C', 0x00, '0', 0x00,
|
|
||||||
'9', 0x00, '2', 0x00, '4', 0x00, '2', 0x00, 'F', 0x00, '7', 0x00, '0', 0x00, '3', 0x00
|
|
||||||
};
|
|
||||||
|
|
||||||
u8 usb_lang_id_string_descriptor[] =
|
|
||||||
{
|
|
||||||
4, 3,
|
|
||||||
0x09, 0x04
|
|
||||||
};
|
|
||||||
|
|
||||||
usbd_t *usbdaemon;
|
usbd_t *usbdaemon;
|
||||||
|
|
||||||
usbd_controller_t *usbd_otg;
|
usbd_controller_t *usbd_otg;
|
||||||
|
@ -1070,15 +1057,15 @@ static void _usbd_handle_get_descriptor(bool *transmit_data, void **descriptor,
|
||||||
*size = usbd_otg->desc->product[0];
|
*size = usbd_otg->desc->product[0];
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
*descriptor = usb_serial_string_descriptor;
|
*descriptor = usbd_otg->desc->serial;
|
||||||
*size = usb_serial_string_descriptor[0];
|
*size = usbd_otg->desc->serial[0];
|
||||||
break;
|
break;
|
||||||
case 0xEE:
|
case 0xEE:
|
||||||
*descriptor = usbd_otg->desc->ms_os;
|
*descriptor = usbd_otg->desc->ms_os;
|
||||||
*size = usbd_otg->desc->ms_os->bLength;
|
*size = usbd_otg->desc->ms_os->bLength;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
*descriptor = usb_lang_id_string_descriptor;
|
*descriptor = usbd_otg->desc->lang_id;
|
||||||
*size = 4;
|
*size = 4;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue