Patchwork [03/14] usb-linux: Teach about super speed

login
register
mail settings
Submitter Hans de Goede
Date May 31, 2011, 9:35 a.m.
Message ID <1306834530-12763-4-git-send-email-hdegoede@redhat.com>
Download mbox | patch
Permalink /patch/97987/
State New
Headers show

Comments

Hans de Goede - May 31, 2011, 9:35 a.m.
---
 usb-linux.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
Gerd Hoffmann - June 1, 2011, 11:28 a.m.
On 05/31/11 11:35, Hans de Goede wrote:
> +            if (!strcmp(buf, "5000")) {
> +                speed = USB_SPEED_SUPER;
> +            } else if (!strcmp(buf, "480")) {

Patch applied.

thanks,
   Gerd

Patch

diff --git a/usb-linux.c b/usb-linux.c
index db28762..672a589 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -1375,7 +1375,9 @@  static int usb_host_scan_dev(void *opaque, USBScanFunc *func)
             if (get_tag_value(buf, sizeof(buf), line, "Spd=", " ") < 0) {
                 goto fail;
             }
-            if (!strcmp(buf, "480")) {
+            if (!strcmp(buf, "5000")) {
+                speed = USB_SPEED_SUPER;
+            } else if (!strcmp(buf, "480")) {
                 speed = USB_SPEED_HIGH;
             } else if (!strcmp(buf, "1.5")) {
                 speed = USB_SPEED_LOW;
@@ -1519,7 +1521,9 @@  static int usb_host_scan_sys(void *opaque, USBScanFunc *func)
             if (!usb_host_read_file(line, sizeof(line), "speed", de->d_name)) {
                 goto the_end;
             }
-            if (!strcmp(line, "480\n")) {
+            if (!strcmp(line, "5000\n")) {
+                speed = USB_SPEED_SUPER;
+            } else if (!strcmp(line, "480\n")) {
                 speed = USB_SPEED_HIGH;
             } else if (!strcmp(line, "1.5\n")) {
                 speed = USB_SPEED_LOW;
@@ -1797,6 +1801,9 @@  static void usb_info_device(Monitor *mon, int bus_num, int addr, char *port,
     case USB_SPEED_HIGH:
         speed_str = "480";
         break;
+    case USB_SPEED_SUPER:
+        speed_str = "5000";
+        break;
     default:
         speed_str = "?";
         break;