• David Brownell's avatar
    [PATCH] usb driverfs, +misc · dcc98433
    David Brownell authored
    This fixes a couple issues I noted when I finally spent some time
    looking at the first version of driverfs support for usb:
    
    - "name" fields (really descriptions) aren't very useful.
    
         * for devices, they always said "USB device 0000:0000"
             --> Now they'll only say that when there's
                 nothing better to be said ...
             --> ... and it's really device 0000:0000!  It was
                 using device descriptor fields before they were
                 fetched from the device.
             --> Uses product and/or manufacturer strings, which
                 most devices have, much like PCI uses the PCI ID
                 database (when it's compiled in)
    
         * for interfaces, it was "figure out some name..."
             --> Now it combines the strings used in the
                 usb_make_path() call with interface number
             --> Or in the remote chance a device provides
                 an interface string, that's preferred.
             --> In general, I think the driver for each
                 interface is best suited to describe it;
                 I modified the hub driver to do so.
    
    - "bus_id" field
    
         * For hub ports, it was wasting code: we know the port
           already, no need to search for it.  Plus, it used
           0-index ids not the 1-index ones matching physical
           labels on hubs, and other user-visible diagnostics.
    
         * For interfaces, it mixed the device address with the
           interface number ... producing unstable IDs that were
           moreover rather cryptic.  Changed:  "if0" now, using
           the interface ID (not index).
    
         * For busses, left "usb_bus" alone ... :)
    
    - Adds two files exposing current configuration (for devices)
       and altsetting (for interfaces).
    
    - I was getting a useless diagnostic from the hub driver,
       now it's less useless (it fully identifies the hub)
    dcc98433
hub.c 32.6 KB