1
0
mirror of https://github.com/gdsports/USBHost_t36 synced 2024-12-21 06:48:54 -05:00

Send set interface to any hub with more than 1 interface altsetting

This commit is contained in:
PaulStoffregen 2018-05-26 08:47:27 -07:00
parent 62fbf401d2
commit f80dbacd7f
2 changed files with 13 additions and 1 deletions

View File

@ -56,7 +56,7 @@
// your best effort to read chapter 4 before asking USB questions!
//#define USBHOST_PRINT_DEBUG
#define USBHOST_PRINT_DEBUG
/************************************************/
/* Data Types */
@ -563,6 +563,7 @@ protected:
void send_clearstatus_overcurrent(uint32_t port);
void send_clearstatus_reset(uint32_t port);
void send_setreset(uint32_t port);
void send_setinterface();
static void callback(const Transfer_t *transfer);
void status_change(const Transfer_t *transfer);
void new_port_status(uint32_t port, uint32_t status);

11
hub.cpp
View File

@ -215,6 +215,14 @@ void USBHub::send_setreset(uint32_t port)
}
}
void USBHub::send_setinterface()
{
// assumes not already sending another control transfer
mk_setup(setup, 1, 11, altsetting, interface_number, 0);
queue_Control_Transfer(device, &setup, NULL, this);
sending_control_transfer = 1;
}
static uint32_t lowestbit(uint32_t bitmask)
{
return __builtin_ctz(bitmask);
@ -234,6 +242,9 @@ void USBHub::control(const Transfer_t *transfer)
numports = hub_desc[2];
characteristics = hub_desc[3];
powertime = hub_desc[5];
if (interface_count > 1) {
send_setinterface();
}
// TODO: do we need to use the DeviceRemovable
// bits to make synthetic device connect events?
println("Hub ports = ", numports);