libusb: emit hci_transport_h2_libusb_emit_usb_info

This commit is contained in:
Matthias Ringwald 2022-04-13 14:55:36 +02:00
parent 09996253d0
commit f85342b49f

View File

@ -233,6 +233,20 @@ static uint16_t usb_product_id;
// transport interface state
static int usb_transport_open;
static void hci_transport_h2_libusb_emit_usb_info(void) {
uint8_t event[7 + USB_MAX_PATH_LEN];
uint16_t pos = 0;
event[pos++] = HCI_EVENT_TRANSPORT_USB_INFO;
event[pos++] = 5 + usb_path_len;
little_endian_store_16(event, pos, usb_vendor_id);
pos+=2;
little_endian_store_16(event, pos, usb_product_id);
pos+=2;
event[pos++] = usb_path_len;
memcpy(&event[pos], usb_path, usb_path_len);
pos += usb_path_len;
(*packet_handler)(HCI_EVENT_PACKET, event, pos);
}
#ifdef ENABLE_SCO_OVER_HCI
static void sco_ring_init(void){
@ -1218,6 +1232,8 @@ static int usb_open(void){
usb_transport_open = 1;
hci_transport_h2_libusb_emit_usb_info();
return 0;
}