瀏覽代碼

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

main
PaulStoffregen 6 年之前
父節點
當前提交
f80dbacd7f
共有 2 個文件被更改,包括 13 次插入1 次删除
  1. +2
    -1
      USBHost_t36.h
  2. +11
    -0
      hub.cpp

+ 2
- 1
USBHost_t36.h 查看文件

@@ -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
- 0
hub.cpp 查看文件

@@ -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);

Loading…
取消
儲存