if (conn_info.DeviceAddress > UINT8_MAX) {
usbi_err(ctx, "program assertion failed: device address overflow");
}
- dev->device_address = (uint8_t)conn_info.DeviceAddress;
+ dev->device_address = (uint8_t)conn_info.DeviceAddress + 1;
+ if (dev->device_address == 1) {
+ usbi_err(ctx, "program assertion failed: device address collision with root hub");
+ }
switch (conn_info.Speed) {
case 0: dev->speed = LIBUSB_SPEED_LOW; break;
case 1: dev->speed = LIBUSB_SPEED_FULL; break;
break;
}
} else {
- dev->device_address = UINT8_MAX; // Hubs from HCD have a devaddr of 255
+ dev->device_address = 1; // root hubs are set to use device number 1
force_hcd_device_descriptor(dev);
}