All:


I was fiddling around with something this weekend and wanted to make sure it 
was valuable before I finished it off.



I've been working to auto-generate Python code to do USB class lookups based on 
the info stored at:

http://www.linux-usb.org/usb.ids



Basically it reads the info in that URL and generates code like:



# USB library

# Generated on: 2011-08-31 00:16:39.468550

def dev_class_to_string(dev_class_id):

        if dev_class_id == 0x0:

                ret_val = '(Defined at Interface level)'

        elif dev_class_id == 0x1:

                ret_val = 'Audio'

        elif dev_class_id == 0x2:

                ret_val = 'Communications'

        elif dev_class_id == 0x3:

                ret_val = 'Human Interface Device'

        elif dev_class_id == 0x5:

                ret_val = 'Physical Interface Device'

        elif dev_class_id == 0x6:

                ret_val = 'Imaging'

        elif dev_class_id == 0x7:

                ret_val = 'Printer'

        elif dev_class_id == 0x8:

                ret_val = 'Mass Storage'

        elif dev_class_id == 0x9:

                ret_val = 'Hub'

        elif dev_class_id == 0xa:

                ret_val = 'CDC Data'

        elif dev_class_id == 0xb:

                ret_val = 'Chip/SmartCard'

        elif dev_class_id == 0xd:

                ret_val = 'Content Security'

        elif dev_class_id == 0xe:

                ret_val = 'Video'

        elif dev_class_id == 0x58:

                ret_val = 'Xbox'

        elif dev_class_id == 0xdc:

                ret_val = 'Diagnostic'

        elif dev_class_id == 0xe0:

                ret_val = 'Wireless'

        elif dev_class_id == 0xef:

                ret_val = 'Miscellaneous Device'

        elif dev_class_id == 0xfe:

                ret_val = 'Application Specific Interface'

        elif dev_class_id == 0xff:

                ret_val = 'Vendor Specific Class'

        else:

                ret_val = 'UNDEFINED'



        return(ret_val)



This would need to get cleaned up and better integrated with the overall libusb 
library, but before I went any farther I wanted to check and see if this was 
functionality that was:

-interesting

-desirable

-etc



There is a bunch of other info at http://www.linux-usb.org/usb.ids with vendor 
and protocol info, etc and the stuff I've been putting together to include that 
as well.  Again - just wanted to see if this was interesting/useful before I 
put in the time to make it more complete.



Thanks,



Dan





Dan Cornell | CTO

------------------------------------------

office 210.572.4400

mobile 210.859.0921

Follow me on Twitter: @danielcornell

------------------------------------------

DENIM GROUP | Create a World Where Technology is Trusted


------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to