Skip to content

Commit

Permalink
Merge pull request #205 from tsundre/add-videocontrol-endpoint-descr
Browse files Browse the repository at this point in the history
lsusb: add VideoControl Endpoint Descriptor
  • Loading branch information
gregkh authored Oct 11, 2024
2 parents 140ba95 + 9f96a67 commit 33b083c
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions lsusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ static void dump_audiocontrol_interface(libusb_device_handle *dev, const unsigne
static void dump_audiostreaming_interface(libusb_device_handle *dev, const unsigned char *buf, int protocol);
static void dump_midistreaming_interface(libusb_device_handle *dev, const unsigned char *buf);
static void dump_videocontrol_interface(libusb_device_handle *dev, const unsigned char *buf, int protocol);
static void dump_videocontrol_interrupt_endpoint(const unsigned char *buf);
static void dump_videostreaming_interface(const unsigned char *buf);
static void dump_dfu_interface(const unsigned char *buf);
static void dump_comm_descriptor(libusb_device_handle *dev, const unsigned char *buf, const char *indent);
Expand Down Expand Up @@ -770,6 +771,10 @@ static void dump_endpoint(libusb_device_handle *dev, const struct libusb_interfa
dump_audiostreaming_endpoint(dev, buf, interface->bInterfaceProtocol);
else if (interface->bInterfaceClass == 1 && interface->bInterfaceSubClass == 3)
dump_midistreaming_endpoint(buf);
else if (interface->bInterfaceClass == 14 &&
interface->bInterfaceSubClass == 1)
dump_videocontrol_interrupt_endpoint(
buf);
break;
case USB_DT_CS_INTERFACE:
/* MISPLACED DESCRIPTOR ... less indent */
Expand Down Expand Up @@ -1755,6 +1760,25 @@ static void dump_videocontrol_interface(libusb_device_handle *dev, const unsigne
free(term);
}

static void dump_videocontrol_interrupt_endpoint(const unsigned char *buf)
{
unsigned int wMaxTransferSize;

if (buf[0] < 5)
printf(" Warning: Descriptor too short\n");
if (buf[1] != USB_DT_CS_ENDPOINT)
printf(" Warning: Invalid descriptor\n");
wMaxTransferSize = buf[3] | (buf[4] << 8);
printf(" VideoControl Endpoint Descriptor:\n"
" bLength %5u\n"
" bDescriptorType %5u\n"
" bDescriptorSubtype %5u (%s)\n"
" wMaxTransferSize %5u\n",
buf[0], buf[1], buf[2], buf[2] == 3 ? "EP_INTERRUPT" : "Invalid",
wMaxTransferSize);
dump_junk(buf, " ", 5);
}

static void dump_videostreaming_interface(const unsigned char *buf)
{
static const char * const colorPrims[] = { "Unspecified", "BT.709,sRGB",
Expand Down

0 comments on commit 33b083c

Please sign in to comment.