mirror of
https://github.com/CTCaer/hekate.git
synced 2024-11-26 11:42:09 +00:00
usb: Improve UMS ejection heuristic
This commit is contained in:
parent
a1188505e8
commit
0ccea3aa83
1 changed files with 10 additions and 4 deletions
|
@ -216,6 +216,7 @@ typedef struct _usbd_gadget_ums_t {
|
||||||
int can_stall;
|
int can_stall;
|
||||||
|
|
||||||
u32 timeouts;
|
u32 timeouts;
|
||||||
|
bool xusb;
|
||||||
|
|
||||||
void (*system_maintenance)(bool);
|
void (*system_maintenance)(bool);
|
||||||
void *label;
|
void *label;
|
||||||
|
@ -1546,18 +1547,20 @@ static int received_cbw(usbd_gadget_ums_t *ums, bulk_ctxt_t *bulk_ctxt)
|
||||||
if (usb_ops.usb_device_get_port_in_sleep())
|
if (usb_ops.usb_device_get_port_in_sleep())
|
||||||
{
|
{
|
||||||
ums->set_text(ums->label, "#C7EA46 Status:# EP in sleep");
|
ums->set_text(ums->label, "#C7EA46 Status:# EP in sleep");
|
||||||
ums->timeouts += 10;
|
ums->timeouts += 14;
|
||||||
}
|
}
|
||||||
else
|
else if (!ums->xusb) // Timeout only on USB2.
|
||||||
|
{
|
||||||
|
ums->timeouts += 4;
|
||||||
DPRINTF("USB: EP removable\n");
|
DPRINTF("USB: EP removable\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gfx_printf("USB: EP disabled\n");
|
gfx_printf("USB: EP disabled\n");
|
||||||
msleep(500);
|
msleep(500);
|
||||||
|
ums->timeouts += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
ums->timeouts += 4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ums->lun.unmounted)
|
if (ums->lun.unmounted)
|
||||||
|
@ -1785,7 +1788,10 @@ int usb_device_gadget_ums(usb_ctxt_t *usbs)
|
||||||
if (hw_get_chip_id() == GP_HIDREV_MAJOR_T210)
|
if (hw_get_chip_id() == GP_HIDREV_MAJOR_T210)
|
||||||
usb_device_get_ops(&usb_ops);
|
usb_device_get_ops(&usb_ops);
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
ums.xusb = true;
|
||||||
xusb_device_get_ops(&usb_ops);
|
xusb_device_get_ops(&usb_ops);
|
||||||
|
}
|
||||||
|
|
||||||
usbs->set_text(usbs->label, "#C7EA46 Status:# Started USB");
|
usbs->set_text(usbs->label, "#C7EA46 Status:# Started USB");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue