USB hot-plugging
This commit is contained in:
parent
2a9caccf7b
commit
1b43dba911
6 changed files with 271 additions and 63 deletions
|
@ -644,10 +644,14 @@ grub_uhci_portstatus (grub_usb_controller_t dev,
|
|||
grub_dprintf ("uhci", "waiting for the port to be enabled\n");
|
||||
|
||||
endtime = grub_get_time_ms () + 1000;
|
||||
while (! (grub_uhci_readreg16 (u, reg) & (1 << 2)))
|
||||
while (! ((status = grub_uhci_readreg16 (u, reg)) & (1 << 2)))
|
||||
if (grub_get_time_ms () > endtime)
|
||||
return grub_error (GRUB_ERR_IO, "UHCI Timed out");
|
||||
|
||||
/* Reset bit Connect Status Change */
|
||||
grub_uhci_writereg16 (u, reg, status | (1 << 1));
|
||||
|
||||
/* Read final port status */
|
||||
status = grub_uhci_readreg16 (u, reg);
|
||||
grub_dprintf ("uhci", ">3detect=0x%02x\n", status);
|
||||
|
||||
|
@ -656,7 +660,7 @@ grub_uhci_portstatus (grub_usb_controller_t dev,
|
|||
}
|
||||
|
||||
static grub_usb_speed_t
|
||||
grub_uhci_detect_dev (grub_usb_controller_t dev, int port)
|
||||
grub_uhci_detect_dev (grub_usb_controller_t dev, int port, int *changed)
|
||||
{
|
||||
struct grub_uhci *u = (struct grub_uhci *) dev->data;
|
||||
int reg;
|
||||
|
@ -676,6 +680,9 @@ grub_uhci_detect_dev (grub_usb_controller_t dev, int port)
|
|||
|
||||
grub_dprintf ("uhci", "detect=0x%02x port=%d\n", status, port);
|
||||
|
||||
/* Connect Status Change bit - it detects change of connection */
|
||||
*changed = ((status & (1 << 1)) != 0);
|
||||
|
||||
if (! (status & 1))
|
||||
return GRUB_USB_SPEED_NONE;
|
||||
else if (status & (1 << 8))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue