Browse Source

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

main
PaulStoffregen 6 years ago
parent
commit
f80dbacd7f
2 changed files with 13 additions and 1 deletions
  1. +2
    -1
      USBHost_t36.h
  2. +11
    -0
      hub.cpp

+ 2
- 1
USBHost_t36.h View File

// your best effort to read chapter 4 before asking USB questions! // your best effort to read chapter 4 before asking USB questions!




//#define USBHOST_PRINT_DEBUG
#define USBHOST_PRINT_DEBUG


/************************************************/ /************************************************/
/* Data Types */ /* Data Types */
void send_clearstatus_overcurrent(uint32_t port); void send_clearstatus_overcurrent(uint32_t port);
void send_clearstatus_reset(uint32_t port); void send_clearstatus_reset(uint32_t port);
void send_setreset(uint32_t port); void send_setreset(uint32_t port);
void send_setinterface();
static void callback(const Transfer_t *transfer); static void callback(const Transfer_t *transfer);
void status_change(const Transfer_t *transfer); void status_change(const Transfer_t *transfer);
void new_port_status(uint32_t port, uint32_t status); void new_port_status(uint32_t port, uint32_t status);

+ 11
- 0
hub.cpp View File

} }
} }


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) static uint32_t lowestbit(uint32_t bitmask)
{ {
return __builtin_ctz(bitmask); return __builtin_ctz(bitmask);
numports = hub_desc[2]; numports = hub_desc[2];
characteristics = hub_desc[3]; characteristics = hub_desc[3];
powertime = hub_desc[5]; powertime = hub_desc[5];
if (interface_count > 1) {
send_setinterface();
}
// TODO: do we need to use the DeviceRemovable // TODO: do we need to use the DeviceRemovable
// bits to make synthetic device connect events? // bits to make synthetic device connect events?
println("Hub ports = ", numports); println("Hub ports = ", numports);

Loading…
Cancel
Save