From f34d119bfadb59e44552a418bd4e64e0b158dcb2 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Thu, 19 Jan 2017 12:12:25 +0100 Subject: [PATCH] libusb: use alternate setting 1 for now, add table for iso packet size for each alt setting --- platform/libusb/hci_transport_h2_libusb.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/platform/libusb/hci_transport_h2_libusb.c b/platform/libusb/hci_transport_h2_libusb.c index 2f7da3d28..b988f1ace 100644 --- a/platform/libusb/hci_transport_h2_libusb.c +++ b/platform/libusb/hci_transport_h2_libusb.c @@ -85,13 +85,23 @@ // 4: Two 8 kHz voice channels with 16-bit encoding or one 16 kHz voice channel with 16-bit encoding // 5: Three 8 kHz voice channels with 16-bit encoding or one 8 kHz voice channel with 16-bit encoding and one 16 kHz voice channel with 16-bit encoding // --> support only a single SCO connection -#define ALT_SETTING (2) +#define ALT_SETTING (1) // for ALT_SETTING >= 1 and 8-bit channel, we need the following isochronous packets // One complete SCO packet with 24 frames every 3 frames (== 3 ms) #define NUM_ISO_PACKETS (3) -// results in 9 bytes per frame -#define ISO_PACKET_SIZE (9) + +const uint16_t iso_packet_size_for_alt_setting[] = { + 0, + 9, + 17, + 25, + 33, + 49, + 63, +}; + +#define ISO_PACKET_SIZE (iso_packet_size_for_alt_setting[ALT_SETTING]) // 49 bytes is the max usb packet size for alternate setting 5 (Three 8 kHz 16-bit channels or one 8 kHz 16-bit channel and one 16 kHz 16-bit channel) // note: alt setting 6 has max packet size of 63 every 7.5 ms = 472.5 bytes / HCI packet, while max SCO packet has 255 byte payload