SEARCH  

NEWS

2010.10.06:11:36:28
Komputronik: rośnie rola usług na rynku salonów komputerowych
Polski rynek salonów komputerowych zmienia swój charakter z typowo sprzedażowego na usługowy. W ten sposób salony wchodzą w wysokomarżowy segment gospodarki, który zajmowany był do tej pory przez wyspecjalizowane firmy. Jednocześnie zyskują nowe atuty w konkurencji z dużymi marketami elektronicznymi.

 

messageID:587660007649
author:HEMA HK
title: PATCH 4 4 parse USB audio class 2 endpoints
Signed-off-by: Daniel Mack <daniel@xxxxxxxx --- lsusb.c | 62 +++++++++++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 45 insertions(+), 17 deletions(-) diff --git a/lsusb.c b/lsusb.c index 31d9b08..43ce219 100644 --- a/lsusb.c +++ b/lsusb.c @@ -119,7 +119,7 @@ static void dump_videostreaming_interface(unsigned char *buf); static void dump_dfu_interface(unsigned char *buf); static char *dump_comm_descriptor(struct usb_dev_handle *dev, unsigned char *buf, char *indent); static void dump_hid_device(struct usb_dev_handle *dev, struct usb_interface_descriptor *interface, unsigned char *buf); -static void dump_audiostreaming_endpoint(unsigned char *buf); +static void dump_audiostreaming_endpoint(unsigned char *buf, int protocol); static void dump_midistreaming_endpoint(unsigned char *buf); static void dump_hub(char *prefix, unsigned char *p, int has_tt); static void dump_ccid_device(unsigned char *buf); @@ -745,7 +745,7 @@ static void dump_endpoint(struct usb_dev_handle *dev, struct usb_interface_descr switch (buf[1]) { case USB_DT_CS_ENDPOINT: if (interface- bInterfaceClass == 1 && interface- bInterfaceSubClass == 2) - dump_audiostreaming_endpoint(buf); + dump_audiostreaming_endpoint(buf, interface- bInterfaceProtocol); else if (interface- bInterfaceClass == 1 && interface- bInterfaceSubClass == 3) dump_midistreaming_endpoint(buf); break; @@ -1862,14 +1862,21 @@ static void dump_audiostreaming_interface(struct usb_dev_handle *dev, unsigned c } } -static void dump_audiostreaming_endpoint(unsigned char *buf) +static const struct bmcontrol uac2_audio_endpoint_bmcontrols[] = { + { "Pitch", 0 }, + { "Data Overrun", 1 }, + { "Data Underrun", 2 }, + { NULL } +}; + +static void dump_audiostreaming_endpoint(unsigned char *buf, int protocol) { static const char *lockdelunits[] = { "Undefined", "Milliseconds", "Decoded PCM samples", "Reserved" }; unsigned int lckdelidx; if (buf[1] != USB_DT_CS_ENDPOINT) printf(" Warning: Invalid descriptor "); - else if (buf[0] < 7) + else if (buf[0] < ((protocol == USB_AUDIO_CLASS_1) ? 7 : 8)) printf(" Warning: Descriptor too short "); printf(" AudioControl Endpoint Descriptor: " " bLength %5u " @@ -1877,19 +1884,40 @@ static void dump_audiostreaming_endpoint(unsigned char *buf) " bDescriptorSubtype %5u (%s) " " bmAttributes 0x%02x ", buf[0], buf[1], buf[2], buf[2] == 1 ? "EP_GENERAL" : "invalid", buf[3]); - if (buf[3] & 1) - printf(" Sampling Frequency "); - if (buf[3] & 2) - printf(" Pitch "); - if (buf[3] & 128) - printf(" MaxPacketsOnly "); - lckdelidx = buf[4]; - if (lckdelidx 3) - lckdelidx = 3; - printf(" bLockDelayUnits %5u %s " - " wLockDelay %5u %s ", - buf[4], lockdelunits[lckdelidx], buf[5] | (buf[6] << 8), lockdelunits[lckdelidx]); - dump_junk(buf, " ", 7); + + switch (protocol) { + case USB_AUDIO_CLASS_1: + if (buf[3] & 1) + printf(" Sampling Frequency "); + if (buf[3] & 2) + printf(" Pitch "); + if (buf[3] & 128) + printf(" MaxPacketsOnly "); + lckdelidx = buf[4]; + if (lckdelidx 3) + lckdelidx = 3; + printf(" bLockDelayUnits %5u %s " + " wLockDelay %5u %s ", + buf[4], lockdelunits[lckdelidx], buf[5] | (buf[6] << 8), lockdelunits[lckdelidx]); + dump_junk(buf, " ", 7); + break; + + case USB_AUDIO_CLASS_2: + if (buf[3] & 128) + printf(" MaxPacketsOnly "); + + printf(" bmControls 0x%02x ", buf[4]); + dump_audio_bmcontrols(" ", buf[4], uac2_audio_endpoint_bmcontrols, protocol); + + lckdelidx = buf[5]; + if (lckdelidx 3) + lckdelidx = 3; + printf(" bLockDelayUnits %5u %s " + " wLockDelay %5u ", + buf[5], lockdelunits[lckdelidx], buf[6] | (buf[7] << 8)); + dump_junk(buf, " ", 8); + break; + } /* switch protocol */ } static void dump_midistreaming_interface(struct usb_dev_handle *dev, unsigned char *buf) -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at rel="nofollow" vger.kernel.org/majordomo-info.html vger.kernel.org/majordomo-info.html
Index