Use status change pipe for hub hotplug detection
This commit is contained in:
parent
f609c84a7f
commit
ff62c48f5a
5 changed files with 167 additions and 32 deletions
|
@ -181,11 +181,19 @@ struct grub_usb_device
|
|||
/* Used by libusb wrapper. Schedulded for removal. */
|
||||
void *data;
|
||||
|
||||
/* Hub information. */
|
||||
|
||||
/* Array of children for a hub. */
|
||||
grub_usb_device_t *children;
|
||||
|
||||
/* Number of hub ports. */
|
||||
unsigned nports;
|
||||
|
||||
grub_usb_transfer_t hub_transfer;
|
||||
|
||||
grub_uint32_t statuschange;
|
||||
|
||||
struct grub_usb_desc_endp *hub_endpoint;
|
||||
};
|
||||
|
||||
|
||||
|
@ -271,5 +279,7 @@ grub_usb_bulk_read_background (grub_usb_device_t dev,
|
|||
int endpoint, grub_size_t size, void *data);
|
||||
grub_usb_err_t
|
||||
grub_usb_check_transfer (grub_usb_transfer_t trans, grub_size_t *actual);
|
||||
void
|
||||
grub_usb_cancel_transfer (grub_usb_transfer_t trans);
|
||||
|
||||
#endif /* GRUB_USB_H */
|
||||
|
|
|
@ -94,31 +94,50 @@ enum
|
|||
GRUB_USB_REQTYPE_VENDOR_IN = GRUB_USB_REQTYPE_VENDOR | GRUB_USB_REQTYPE_IN
|
||||
};
|
||||
|
||||
#define GRUB_USB_REQ_GET_STATUS 0x00
|
||||
#define GRUB_USB_REQ_CLEAR_FEATURE 0x01
|
||||
#define GRUB_USB_REQ_SET_FEATURE 0x03
|
||||
#define GRUB_USB_REQ_SET_ADDRESS 0x05
|
||||
#define GRUB_USB_REQ_GET_DESCRIPTOR 0x06
|
||||
#define GRUB_USB_REQ_SET_DESCRIPTOR 0x07
|
||||
#define GRUB_USB_REQ_GET_CONFIGURATION 0x08
|
||||
#define GRUB_USB_REQ_SET_CONFIGURATION 0x09
|
||||
#define GRUB_USB_REQ_GET_INTERFACE 0x0A
|
||||
#define GRUB_USB_REQ_SET_INTERFACE 0x0B
|
||||
#define GRUB_USB_REQ_SYNC_FRAME 0x0C
|
||||
enum
|
||||
{
|
||||
GRUB_USB_REQ_GET_STATUS = 0x00,
|
||||
GRUB_USB_REQ_CLEAR_FEATURE = 0x01,
|
||||
GRUB_USB_REQ_SET_FEATURE = 0x03,
|
||||
GRUB_USB_REQ_SET_ADDRESS = 0x05,
|
||||
GRUB_USB_REQ_GET_DESCRIPTOR = 0x06,
|
||||
GRUB_USB_REQ_SET_DESCRIPTOR = 0x07,
|
||||
GRUB_USB_REQ_GET_CONFIGURATION = 0x08,
|
||||
GRUB_USB_REQ_SET_CONFIGURATION = 0x09,
|
||||
GRUB_USB_REQ_GET_INTERFACE = 0x0A,
|
||||
GRUB_USB_REQ_SET_INTERFACE = 0x0B,
|
||||
GRUB_USB_REQ_SYNC_FRAME = 0x0C
|
||||
};
|
||||
|
||||
#define GRUB_USB_FEATURE_ENDP_HALT 0x00
|
||||
#define GRUB_USB_FEATURE_DEV_REMOTE_WU 0x01
|
||||
#define GRUB_USB_FEATURE_TEST_MODE 0x02
|
||||
|
||||
#define GRUB_USB_HUB_FEATURE_PORT_RESET 0x04
|
||||
#define GRUB_USB_HUB_FEATURE_PORT_POWER 0x08
|
||||
#define GRUB_USB_HUB_FEATURE_C_CONNECTED 0x10
|
||||
enum
|
||||
{
|
||||
GRUB_USB_HUB_FEATURE_PORT_RESET = 0x04,
|
||||
GRUB_USB_HUB_FEATURE_PORT_POWER = 0x08,
|
||||
GRUB_USB_HUB_FEATURE_C_PORT_CONNECTED = 0x10,
|
||||
GRUB_USB_HUB_FEATURE_C_PORT_ENABLED = 0x11,
|
||||
GRUB_USB_HUB_FEATURE_C_PORT_SUSPEND = 0x12,
|
||||
GRUB_USB_HUB_FEATURE_C_PORT_OVERCURRENT = 0x13,
|
||||
GRUB_USB_HUB_FEATURE_C_PORT_RESET = 0x14
|
||||
};
|
||||
|
||||
#define GRUB_USB_HUB_STATUS_CONNECTED (1 << 0)
|
||||
#define GRUB_USB_HUB_STATUS_LOWSPEED (1 << 9)
|
||||
#define GRUB_USB_HUB_STATUS_HIGHSPEED (1 << 10)
|
||||
#define GRUB_USB_HUB_STATUS_C_CONNECTED (1 << 16)
|
||||
#define GRUB_USB_HUB_STATUS_C_PORT_RESET (1 << 20)
|
||||
enum
|
||||
{
|
||||
GRUB_USB_HUB_STATUS_PORT_CONNECTED = (1 << 0),
|
||||
GRUB_USB_HUB_STATUS_PORT_ENABLED = (1 << 1),
|
||||
GRUB_USB_HUB_STATUS_PORT_SUSPEND = (1 << 2),
|
||||
GRUB_USB_HUB_STATUS_PORT_OVERCURRENT = (1 << 3),
|
||||
GRUB_USB_HUB_STATUS_PORT_LOWSPEED = (1 << 9),
|
||||
GRUB_USB_HUB_STATUS_PORT_HIGHSPEED = (1 << 10),
|
||||
GRUB_USB_HUB_STATUS_C_PORT_CONNECTED = (1 << 16),
|
||||
GRUB_USB_HUB_STATUS_C_PORT_ENABLED = (1 << 17),
|
||||
GRUB_USB_HUB_STATUS_C_PORT_SUSPEND = (1 << 18),
|
||||
GRUB_USB_HUB_STATUS_C_PORT_OVERCURRENT = (1 << 19),
|
||||
GRUB_USB_HUB_STATUS_C_PORT_RESET = (1 << 20)
|
||||
};
|
||||
|
||||
struct grub_usb_packet_setup
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue