|
@@ -643,186 +643,6 @@ static inline int usb_make_path(struct usb_device *dev, char *buf, size_t size)
|
|
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
|
|
-/**
|
|
|
- * usb_endpoint_num - get the endpoint's number
|
|
|
- * @epd: endpoint to be checked
|
|
|
- *
|
|
|
- * Returns @epd's number: 0 to 15.
|
|
|
- */
|
|
|
-static inline int usb_endpoint_num(const struct usb_endpoint_descriptor *epd)
|
|
|
-{
|
|
|
- return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * usb_endpoint_type - get the endpoint's transfer type
|
|
|
- * @epd: endpoint to be checked
|
|
|
- *
|
|
|
- * Returns one of USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT} according
|
|
|
- * to @epd's transfer type.
|
|
|
- */
|
|
|
-static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd)
|
|
|
-{
|
|
|
- return epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * usb_endpoint_dir_in - check if the endpoint has IN direction
|
|
|
- * @epd: endpoint to be checked
|
|
|
- *
|
|
|
- * Returns true if the endpoint is of type IN, otherwise it returns false.
|
|
|
- */
|
|
|
-static inline int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd)
|
|
|
-{
|
|
|
- return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN);
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * usb_endpoint_dir_out - check if the endpoint has OUT direction
|
|
|
- * @epd: endpoint to be checked
|
|
|
- *
|
|
|
- * Returns true if the endpoint is of type OUT, otherwise it returns false.
|
|
|
- */
|
|
|
-static inline int usb_endpoint_dir_out(
|
|
|
- const struct usb_endpoint_descriptor *epd)
|
|
|
-{
|
|
|
- return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * usb_endpoint_xfer_bulk - check if the endpoint has bulk transfer type
|
|
|
- * @epd: endpoint to be checked
|
|
|
- *
|
|
|
- * Returns true if the endpoint is of type bulk, otherwise it returns false.
|
|
|
- */
|
|
|
-static inline int usb_endpoint_xfer_bulk(
|
|
|
- const struct usb_endpoint_descriptor *epd)
|
|
|
-{
|
|
|
- return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
|
|
|
- USB_ENDPOINT_XFER_BULK);
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * usb_endpoint_xfer_control - check if the endpoint has control transfer type
|
|
|
- * @epd: endpoint to be checked
|
|
|
- *
|
|
|
- * Returns true if the endpoint is of type control, otherwise it returns false.
|
|
|
- */
|
|
|
-static inline int usb_endpoint_xfer_control(
|
|
|
- const struct usb_endpoint_descriptor *epd)
|
|
|
-{
|
|
|
- return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
|
|
|
- USB_ENDPOINT_XFER_CONTROL);
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * usb_endpoint_xfer_int - check if the endpoint has interrupt transfer type
|
|
|
- * @epd: endpoint to be checked
|
|
|
- *
|
|
|
- * Returns true if the endpoint is of type interrupt, otherwise it returns
|
|
|
- * false.
|
|
|
- */
|
|
|
-static inline int usb_endpoint_xfer_int(
|
|
|
- const struct usb_endpoint_descriptor *epd)
|
|
|
-{
|
|
|
- return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
|
|
|
- USB_ENDPOINT_XFER_INT);
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * usb_endpoint_xfer_isoc - check if the endpoint has isochronous transfer type
|
|
|
- * @epd: endpoint to be checked
|
|
|
- *
|
|
|
- * Returns true if the endpoint is of type isochronous, otherwise it returns
|
|
|
- * false.
|
|
|
- */
|
|
|
-static inline int usb_endpoint_xfer_isoc(
|
|
|
- const struct usb_endpoint_descriptor *epd)
|
|
|
-{
|
|
|
- return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
|
|
|
- USB_ENDPOINT_XFER_ISOC);
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * usb_endpoint_is_bulk_in - check if the endpoint is bulk IN
|
|
|
- * @epd: endpoint to be checked
|
|
|
- *
|
|
|
- * Returns true if the endpoint has bulk transfer type and IN direction,
|
|
|
- * otherwise it returns false.
|
|
|
- */
|
|
|
-static inline int usb_endpoint_is_bulk_in(
|
|
|
- const struct usb_endpoint_descriptor *epd)
|
|
|
-{
|
|
|
- return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd));
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * usb_endpoint_is_bulk_out - check if the endpoint is bulk OUT
|
|
|
- * @epd: endpoint to be checked
|
|
|
- *
|
|
|
- * Returns true if the endpoint has bulk transfer type and OUT direction,
|
|
|
- * otherwise it returns false.
|
|
|
- */
|
|
|
-static inline int usb_endpoint_is_bulk_out(
|
|
|
- const struct usb_endpoint_descriptor *epd)
|
|
|
-{
|
|
|
- return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd));
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * usb_endpoint_is_int_in - check if the endpoint is interrupt IN
|
|
|
- * @epd: endpoint to be checked
|
|
|
- *
|
|
|
- * Returns true if the endpoint has interrupt transfer type and IN direction,
|
|
|
- * otherwise it returns false.
|
|
|
- */
|
|
|
-static inline int usb_endpoint_is_int_in(
|
|
|
- const struct usb_endpoint_descriptor *epd)
|
|
|
-{
|
|
|
- return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd));
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * usb_endpoint_is_int_out - check if the endpoint is interrupt OUT
|
|
|
- * @epd: endpoint to be checked
|
|
|
- *
|
|
|
- * Returns true if the endpoint has interrupt transfer type and OUT direction,
|
|
|
- * otherwise it returns false.
|
|
|
- */
|
|
|
-static inline int usb_endpoint_is_int_out(
|
|
|
- const struct usb_endpoint_descriptor *epd)
|
|
|
-{
|
|
|
- return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd));
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * usb_endpoint_is_isoc_in - check if the endpoint is isochronous IN
|
|
|
- * @epd: endpoint to be checked
|
|
|
- *
|
|
|
- * Returns true if the endpoint has isochronous transfer type and IN direction,
|
|
|
- * otherwise it returns false.
|
|
|
- */
|
|
|
-static inline int usb_endpoint_is_isoc_in(
|
|
|
- const struct usb_endpoint_descriptor *epd)
|
|
|
-{
|
|
|
- return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd));
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * usb_endpoint_is_isoc_out - check if the endpoint is isochronous OUT
|
|
|
- * @epd: endpoint to be checked
|
|
|
- *
|
|
|
- * Returns true if the endpoint has isochronous transfer type and OUT direction,
|
|
|
- * otherwise it returns false.
|
|
|
- */
|
|
|
-static inline int usb_endpoint_is_isoc_out(
|
|
|
- const struct usb_endpoint_descriptor *epd)
|
|
|
-{
|
|
|
- return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd));
|
|
|
-}
|
|
|
-
|
|
|
-/*-------------------------------------------------------------------------*/
|
|
|
-
|
|
|
#define USB_DEVICE_ID_MATCH_DEVICE \
|
|
|
(USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT)
|
|
|
#define USB_DEVICE_ID_MATCH_DEV_RANGE \
|