[gnome-multi-writer] Add quirks for the 36 port MegaHub



commit 954f1f4ffecff9e3e77ff82fc2a9deb6e4cadc6a
Author: Richard Hughes <richard hughsie com>
Date:   Thu Jan 15 21:43:31 2015 +0000

    Add quirks for the 36 port MegaHub

 src/gmw-device.c |  140 +++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 103 insertions(+), 37 deletions(-)
---
diff --git a/src/gmw-device.c b/src/gmw-device.c
index e0afb01..1529a6d 100644
--- a/src/gmw-device.c
+++ b/src/gmw-device.c
@@ -580,13 +580,14 @@ gmw_device_set_udisks_drive (GmwDevice *device, UDisksDrive *udisks_drive)
 }
 
 typedef struct {
-       guint16          parent_vid;            /* +1 */
-       guint16          parent_pid;            /* +1 */
-       guint16          grandparent_vid;       /* +2, or 0x0000 */
-       guint16          grandparent_pid;       /* +2, or 0x0000 */
+       guint16          hub_vid;               /* +1 */
+       guint16          hub_pid;               /* +1 */
+       guint8           hub_port;              /* electrical, not physical */
+       guint16          hub_parent_vid;        /* +2, or 0x0000 */
+       guint16          hub_parent_pid;        /* +2, or 0x0000 */
        guint16          child_vid;             /* -1, or 0x0000 */
        guint16          child_pid;             /* -1, or 0x0000 */
-       guint8           port_number;           /* electrical, not physical */
+       guint8           device_port;           /* electrical, not physical */
        guint8           chain_len;             /* internal chain number */
        const gchar     *hub_label;             /* decal on the box */
 } GmwDeviceQuirk;
@@ -611,27 +612,84 @@ gmw_device_set_usb_device (GmwDevice *device, GUsbDevice *usb_device)
        _cleanup_object_unref_ GUsbDevice *usb_hub = NULL;
        _cleanup_object_unref_ GUsbDevice *usb_hub_parent = NULL;
        const GmwDeviceQuirk quirks[] = {
-               /*
-                * Orico PIO Series Hub
-                *
-                *  [USB]
-                *    |
-                * [0x1a40:0x0101] --- [____0x1a40:0x0201_____]
-                *    |   |   |         |   |   |   |    |   |
-                *    #1  #2  #3        #4  #5  #6  #10  #9  #8
-                */
-               { 0x1a40, 0x0101, 0x0000, 0x0000, 0x1a40, 0x0201, 0x01, 0x00, "01" },
-               { 0x1a40, 0x0101, 0x0000, 0x0000, 0x1a40, 0x0201, 0x02, 0x00, "02" },
-               { 0x1a40, 0x0101, 0x0000, 0x0000, 0x1a40, 0x0201, 0x03, 0x00, "03" },
-               { 0x1a40, 0x0201, 0x1a40, 0x0101, 0x0000, 0x0000, 0x01, 0x01, "04" },
-               { 0x1a40, 0x0201, 0x1a40, 0x0101, 0x0000, 0x0000, 0x02, 0x01, "05" },
-               { 0x1a40, 0x0201, 0x1a40, 0x0101, 0x0000, 0x0000, 0x03, 0x01, "06" },
-               { 0x1a40, 0x0201, 0x1a40, 0x0101, 0x0000, 0x0000, 0x04, 0x01, "07" },
-               { 0x1a40, 0x0201, 0x1a40, 0x0101, 0x0000, 0x0000, 0x07, 0x01, "08" },
-               { 0x1a40, 0x0201, 0x1a40, 0x0101, 0x0000, 0x0000, 0x06, 0x01, "09" },
-               { 0x1a40, 0x0201, 0x1a40, 0x0101, 0x0000, 0x0000, 0x05, 0x01, "10" },
-               /* last entry */
-               { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, NULL }
+       /*
+        * Orico PIO Series Hub
+        *
+        * Numbered from the top connector down.
+        *
+        *  [USB]
+        *    |
+        * [0x1a40:0x0101]--4-- [____0x1a40:0x0201_____]
+        *   1|  2|  3|         1|  2|  3|  4|   5|  6|
+        *   #01 #02 #03       #04 #05 #06 #10  #09 #08
+        */
+       /*     hub      hub-port  parent-hub     child-device  d-prt  chain */
+       { 0x1a40, 0x0101, 0x00, 0x0000, 0x0000, 0x1a40, 0x0201, 0x01, 0x0, "01" },
+       { 0x1a40, 0x0101, 0x00, 0x0000, 0x0000, 0x1a40, 0x0201, 0x02, 0x0, "02" },
+       { 0x1a40, 0x0101, 0x00, 0x0000, 0x0000, 0x1a40, 0x0201, 0x03, 0x0, "03" },
+       { 0x1a40, 0x0201, 0x04, 0x1a40, 0x0101, 0x0000, 0x0000, 0x01, 0x1, "04" },
+       { 0x1a40, 0x0201, 0x04, 0x1a40, 0x0101, 0x0000, 0x0000, 0x02, 0x1, "05" },
+       { 0x1a40, 0x0201, 0x04, 0x1a40, 0x0101, 0x0000, 0x0000, 0x03, 0x1, "06" },
+       { 0x1a40, 0x0201, 0x04, 0x1a40, 0x0101, 0x0000, 0x0000, 0x04, 0x1, "07" },
+       { 0x1a40, 0x0201, 0x04, 0x1a40, 0x0101, 0x0000, 0x0000, 0x07, 0x1, "08" },
+       { 0x1a40, 0x0201, 0x04, 0x1a40, 0x0101, 0x0000, 0x0000, 0x06, 0x1, "09" },
+       { 0x1a40, 0x0201, 0x04, 0x1a40, 0x0101, 0x0000, 0x0000, 0x05, 0x1, "10" },
+
+       /*
+        * MegaHub - 36 Port Powered USB 2.0 Hub
+        *
+        * Numbered from the connector to the right of the power connector and
+        * going counter-clockwise.
+        *
+        *  [USB]
+        *    |
+        * [0x1a40:0x0201] -.-5-- [______0x1a40:0x0201______]
+        *     2|  7|       |         1|  2|  3|  4|  7|
+        *     TP2 TP1      |         01T 01M 01B 02T 02M
+        *                  |
+        *                  '-6-- [______0x1a40:0x0201______]
+        *                  |     1|  2|  3|  4|  5|  6|  7|
+        *                  |     04B 04T 04M 03B 02B 03M 03T
+        *                  \..
+        */
+       { 0x1a40, 0x0201, 0x00, 0x0000, 0x0000, 0x1a40, 0x0201, 0x07, 0x0, "TP1" },
+       { 0x1a40, 0x0201, 0x00, 0x0000, 0x0000, 0x1a40, 0x0201, 0x02, 0x0, "TP2" },
+       { 0x1a40, 0x0201, 0x05, 0x1a40, 0x0201, 0x0000, 0x0000, 0x04, 0x1, "01T" },
+       { 0x1a40, 0x0201, 0x05, 0x1a40, 0x0201, 0x0000, 0x0000, 0x07, 0x1, "01M" },
+       { 0x1a40, 0x0201, 0x05, 0x1a40, 0x0201, 0x0000, 0x0000, 0x03, 0x1, "01B" },
+       { 0x1a40, 0x0201, 0x05, 0x1a40, 0x0201, 0x0000, 0x0000, 0x01, 0x1, "02T" },
+       { 0x1a40, 0x0201, 0x05, 0x1a40, 0x0201, 0x0000, 0x0000, 0x02, 0x1, "02M" },
+       { 0x1a40, 0x0201, 0x06, 0x1a40, 0x0201, 0x0000, 0x0000, 0x05, 0x1, "02B" },
+       { 0x1a40, 0x0201, 0x06, 0x1a40, 0x0201, 0x0000, 0x0000, 0x07, 0x1, "03T" },
+       { 0x1a40, 0x0201, 0x06, 0x1a40, 0x0201, 0x0000, 0x0000, 0x06, 0x1, "03M" },
+       { 0x1a40, 0x0201, 0x06, 0x1a40, 0x0201, 0x0000, 0x0000, 0x04, 0x1, "03B" },
+       { 0x1a40, 0x0201, 0x06, 0x1a40, 0x0201, 0x0000, 0x0000, 0x02, 0x1, "04T" },
+       { 0x1a40, 0x0201, 0x06, 0x1a40, 0x0201, 0x0000, 0x0000, 0x03, 0x1, "04M" },
+       { 0x1a40, 0x0201, 0x06, 0x1a40, 0x0201, 0x0000, 0x0000, 0x01, 0x1, "04B" },
+       { 0x1a40, 0x0201, 0x04, 0x1a40, 0x0201, 0x0000, 0x0000, 0x06, 0x1, "05T" },
+       { 0x1a40, 0x0201, 0x04, 0x1a40, 0x0201, 0x0000, 0x0000, 0x05, 0x1, "05M" },
+       { 0x1a40, 0x0201, 0x04, 0x1a40, 0x0201, 0x0000, 0x0000, 0x07, 0x1, "05B" },
+       { 0x1a40, 0x0201, 0x04, 0x1a40, 0x0201, 0x0000, 0x0000, 0x03, 0x1, "06T" },
+       { 0x1a40, 0x0201, 0x04, 0x1a40, 0x0201, 0x0000, 0x0000, 0x02, 0x1, "06M" },
+       { 0x1a40, 0x0201, 0x04, 0x1a40, 0x0201, 0x0000, 0x0000, 0x04, 0x1, "06B" },
+       { 0x1a40, 0x0201, 0x03, 0x1a40, 0x0201, 0x0000, 0x0000, 0x05, 0x1, "07T" },
+       { 0x1a40, 0x0201, 0x03, 0x1a40, 0x0201, 0x0000, 0x0000, 0x06, 0x1, "07M" },
+       { 0x1a40, 0x0201, 0x04, 0x1a40, 0x0201, 0x0000, 0x0000, 0x01, 0x1, "07B" },
+       { 0x1a40, 0x0201, 0x03, 0x1a40, 0x0201, 0x0000, 0x0000, 0x04, 0x1, "08T" },
+       { 0x1a40, 0x0201, 0x03, 0x1a40, 0x0201, 0x0000, 0x0000, 0x07, 0x1, "08M" },
+       { 0x1a40, 0x0201, 0x03, 0x1a40, 0x0201, 0x0000, 0x0000, 0x03, 0x1, "08B" },
+       { 0x1a40, 0x0201, 0x03, 0x1a40, 0x0201, 0x0000, 0x0000, 0x01, 0x1, "09T" },
+       { 0x1a40, 0x0201, 0x03, 0x1a40, 0x0201, 0x0000, 0x0000, 0x02, 0x1, "09M" },
+       { 0x1a40, 0x0201, 0x01, 0x1a40, 0x0201, 0x0000, 0x0000, 0x05, 0x1, "09B" },
+       { 0x1a40, 0x0201, 0x01, 0x1a40, 0x0201, 0x0000, 0x0000, 0x07, 0x1, "10T" },
+       { 0x1a40, 0x0201, 0x01, 0x1a40, 0x0201, 0x0000, 0x0000, 0x06, 0x1, "10M" },
+       { 0x1a40, 0x0201, 0x01, 0x1a40, 0x0201, 0x0000, 0x0000, 0x04, 0x1, "10B" },
+       { 0x1a40, 0x0201, 0x01, 0x1a40, 0x0201, 0x0000, 0x0000, 0x02, 0x1, "11T" },
+       { 0x1a40, 0x0201, 0x01, 0x1a40, 0x0201, 0x0000, 0x0000, 0x03, 0x1, "11M" },
+       { 0x1a40, 0x0201, 0x01, 0x1a40, 0x0201, 0x0000, 0x0000, 0x01, 0x1, "11B" },
+
+       /* /----hub---------\   /-parent-hub-\   /-children-\   /pt\  /ch\ */
+       { 0x0000, 0x0000, 0x00, 0x0000, 0x0000, 0x0000, 0x0000, 0x00, 0x00, NULL }
        };
 
        g_return_if_fail (GMW_IS_DEVICE (device));
@@ -650,29 +708,37 @@ gmw_device_set_usb_device (GmwDevice *device, GUsbDevice *usb_device)
 
        /* find the two parents */
        usb_hub_parent = g_usb_device_get_parent (usb_hub);
-       g_debug ("Quirk info: 0x%04x, 0x%04x, 0x%04x, 0x%04x, 0x%02x for 0x%04x:0x%04x",
+       g_debug ("Quirk info: 0x%04x:0x%04x 0x%02x->"
+                            "0x%04x:0x%04x 0x%02x->"
+                            "0x%04x:0x%04x 0x%02x",
                 g_usb_device_get_vid (usb_hub),
                 g_usb_device_get_pid (usb_hub),
+                g_usb_device_get_port_number (usb_hub),
                 usb_hub_parent ? g_usb_device_get_vid (usb_hub_parent) : 0x0,
                 usb_hub_parent ? g_usb_device_get_pid (usb_hub_parent) : 0x0,
-                g_usb_device_get_port_number (usb_device),
+                usb_hub_parent ? g_usb_device_get_port_number (usb_hub_parent) : 0x0,
                 g_usb_device_get_vid (usb_device),
-                g_usb_device_get_pid (usb_device));
+                g_usb_device_get_pid (usb_device),
+                g_usb_device_get_port_number (usb_device));
 
        for (i = 0; quirks[i].hub_label != NULL; i++) {
                /* check grandparent */
-               if (usb_hub_parent != NULL && quirks[i].grandparent_vid != 0x0000) {
-                       if (quirks[i].grandparent_vid != g_usb_device_get_vid (usb_hub_parent))
+               if (usb_hub_parent != NULL && quirks[i].hub_parent_vid != 0x0000) {
+                       if (quirks[i].hub_parent_vid != g_usb_device_get_vid (usb_hub_parent))
                                continue;
-                       if (quirks[i].grandparent_pid != g_usb_device_get_pid (usb_hub_parent))
+                       if (quirks[i].hub_parent_pid != g_usb_device_get_pid (usb_hub_parent))
                                continue;
                }
 
                /* check parent */
-               if (usb_hub != NULL && quirks[i].parent_vid != 0x0000) {
-                       if (quirks[i].parent_vid != g_usb_device_get_vid (usb_hub))
+               if (usb_hub != NULL && quirks[i].hub_vid != 0x0000) {
+                       if (quirks[i].hub_vid != g_usb_device_get_vid (usb_hub))
                                continue;
-                       if (quirks[i].parent_pid != g_usb_device_get_pid (usb_hub))
+                       if (quirks[i].hub_pid != g_usb_device_get_pid (usb_hub))
+                               continue;
+               }
+               if (usb_hub != NULL && quirks[i].hub_port != 0x00) {
+                       if (quirks[i].hub_port != g_usb_device_get_port_number (usb_hub))
                                continue;
                }
 
@@ -697,8 +763,8 @@ gmw_device_set_usb_device (GmwDevice *device, GUsbDevice *usb_device)
                }
 
                /* check port number */
-               if (quirks[i].port_number != 0x00) {
-                       if (quirks[i].port_number != g_usb_device_get_port_number (usb_device))
+               if (quirks[i].device_port != 0x00) {
+                       if (quirks[i].device_port != g_usb_device_get_port_number (usb_device))
                                continue;
                }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]