Skip to content

Instantly share code, notes, and snippets.

@agusmakmun
Created February 9, 2015 02:38
Show Gist options
  • Save agusmakmun/d034637e18c685691c29 to your computer and use it in GitHub Desktop.
Save agusmakmun/d034637e18c685691c29 to your computer and use it in GitHub Desktop.
Instalasi PyUsb pada Linux (Ubuntu 14.04) - python.web.id
'''
See More: http://python.web.id/instalasi-pyusb-pada-python/
Terminal:
$ wget http://downloads.sourceforge.net/project/pyusb/PyUSB%201.0/1.0.0-beta-2/pyusb-1.0.0b2.tar.gz
$ tar xvzf pyusb-1.0.0b2.tar.gz
$ cd pyusb-1.0.0b2
$ sudo ./setup.py install
'''
>>> import usb.core
>>> usb.core.show_devices()
DEVICE ID 1871:0101 on Bus 002 Address 004, Miscellaneous
DEVICE ID 8087:0024 on Bus 002 Address 002, Hub
DEVICE ID 1d6b:0002 on Bus 002 Address 001, Hub
DEVICE ID 1bcf:2c18 on Bus 001 Address 003, Miscellaneous
DEVICE ID 8087:0024 on Bus 001 Address 002, Hub
DEVICE ID 1d6b:0002 on Bus 001 Address 001, Hub
>>> devices = usb.core.find(True, idVendor=0x1bcf, idProduct=0x2c18)
>>> for dev in devices:
... print dev.manufacturer, dev.product
...
NC.21411.00X3110A5CALM0009 HD WebCam
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment