diff options
Diffstat (limited to 'include/libtio/io/usb.h')
-rw-r--r-- | include/libtio/io/usb.h | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/include/libtio/io/usb.h b/include/libtio/io/usb.h index b761bd1..aed26a9 100644 --- a/include/libtio/io/usb.h +++ b/include/libtio/io/usb.h @@ -8,9 +8,28 @@ TIO_BEGIN_NAMESPACE * Using such a stream, you can send USB requests and receive the answer * (act as the master). * - * USB packets are described in the callbacks section. */ + * USB packets are described in the callbacks section. + * + * Descriptors (for finding and giving information about connected USB + * devices) have the following structure: */ + +TIO_STRUCT(tio_usb_device, tio_usb_device_t) + +struct tio_usb_device { + /* Localisation on the USB buses. */ + + int tio_usb_device_bus; + int tio_usb_device_address; -/* TODO: USB descriptors. */ + /* Data. */ + + int tio_usb_device_class; /* bDeviceClass */ + int tio_usb_device_subclass; /* bDeviceSubClass */ + int tio_usb_device_protocol; /* bDeviceProtocol */ + + unsigned int tio_usb_device_vendor_id; /* idVendor */ + unsigned int tio_usb_device_product_id; /* idProduct */ +}; /* --- * Utilities. @@ -18,7 +37,14 @@ TIO_BEGIN_NAMESPACE TIO_BEGIN_DECLS -/* TODO: list USB devices. */ +/* List the available USB devices. + * The iterator yields strings (`char const *`) representing the path. */ + +TIO_EXTERN(int) tio_list_usb_devices + OF((tio_iter_t **tio__iterp)); + +# define tio_next_usb_device(ITER, PTRP) \ + (tio_next((ITER), (void **)(tio_usb_device_t **)(PTRP))) TIO_END_DECLS TIO_END_NAMESPACE |