mac libusb java_PyUSB-Dev-Env on Mac with libusb

46d6f47c3452

usb logo

Dependencies

Procedure

Find VendorID & ProductID on Mac

system_profiler SPUSBDataType

or u may prefer lsusb, if u come from Linux-like system:

brew update && brew tap jlhonora/lsusb && brew install lsusb

46d6f47c3452

lsusb

Install libusb libarary via Homebrew

brew install libusb-compat libusb

or you will encounter issue below when u use pyusb

Traceback (most recent call last):

File "", line 1, in

usb.core.find()

File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/usb/core.py", line 1199, in find

raise ValueError('No backend available')

ValueError: No backend available

Setup pyusb via pip

pip install pyusb

use pyusb to detect usb(STM32 STlink NUCLEO-F401RE)

46d6f47c3452

NUCLEO-F401RE

# ipython or bpython

>>> import usb.core

## see idVendor & idProduct via `lsusb`

>>> stm32 = usb.core.find(idVendor=0x0483,idProduct=0x374b)

>>> print stm32

DEVICE ID 0483:374b on Bus 020 Address 013 =================

bLength : 0x12 (18 bytes)

bDescriptorType : 0x1 Device

bcdUSB : 0x200 USB 2.0

bDeviceClass : 0xef Miscellaneous

bDeviceSubClass : 0x2

bDeviceProtocol : 0x1

bMaxPacketSize0 : 0x40 (64 bytes)

idVendor : 0x0483

idProduct : 0x374b

bcdDevice : 0x100 Device 1.0

iManufacturer : 0x1 STMicroelectronics

iProduct : 0x2 STM32 STLink

iSerialNumber : 0x3 066EFF494951785087033631

bNumConfigurations : 0x1

CONFIGURATION 1: 300 mA ==================================

bLength : 0x9 (9 bytes)

bDescriptorType : 0x2 Configuration

wTotalLength : 0x80 (128 bytes)

bNumInterfaces : 0x4

bConfigurationValue : 0x1

iConfiguration : 0x0

bmAttributes : 0x80 Bus Powered

bMaxPower : 0x96 (300 mA)

INTERFACE 0: Vendor Specific ===========================

bLength : 0x9 (9 bytes)

bDescriptorType : 0x4 Interface

bInterfaceNumber : 0x0

bAlternateSetting : 0x0

bNumEndpoints : 0x3

bInterfaceClass : 0xff Vendor Specific

bInterfaceSubClass : 0xff

bInterfaceProtocol : 0xff

iInterface : 0x4 ST-Link Debug

ENDPOINT 0x81: Bulk IN ===============================

bLength : 0x7 (7 bytes)

bDescriptorType : 0x5 Endpoint

bEndpointAddress : 0x81 IN

bmAttributes : 0x2 Bulk

wMaxPacketSize : 0x40 (64 bytes)

bInterval : 0x0

ENDPOINT 0x1: Bulk OUT ===============================

bLength : 0x7 (7 bytes)

bDescriptorType : 0x5 Endpoint

bEndpointAddress : 0x1 OUT

bmAttributes : 0x2 Bulk

wMaxPacketSize : 0x40 (64 bytes)

bInterval : 0x0

ENDPOINT 0x82: Bulk IN ===============================

bLength : 0x7 (7 bytes)

bDescriptorType : 0x5 Endpoint

bEndpointAddress : 0x82 IN

bmAttributes : 0x2 Bulk

wMaxPacketSize : 0x30 (48 bytes)

bInterval : 0x0

INTERFACE 1: Mass Storage ==============================

bLength : 0x9 (9 bytes)

bDescriptorType : 0x4 Interface

bInterfaceNumber : 0x1

bAlternateSetting : 0x0

bNumEndpoints : 0x2

bInterfaceClass : 0x8 Mass Storage

bInterfaceSubClass : 0x6

bInterfaceProtocol : 0x50

iInterface : 0x5 ST-Link mass storage

ENDPOINT 0x83: Bulk IN ===============================

bLength : 0x7 (7 bytes)

bDescriptorType : 0x5 Endpoint

bEndpointAddress : 0x83 IN

bmAttributes : 0x2 Bulk

wMaxPacketSize : 0x40 (64 bytes)

bInterval : 0x0

ENDPOINT 0x3: Bulk OUT ===============================

bLength : 0x7 (7 bytes)

bDescriptorType : 0x5 Endpoint

bEndpointAddress : 0x3 OUT

bmAttributes : 0x2 Bulk

wMaxPacketSize : 0x40 (64 bytes)

bInterval : 0x0

INTERFACE 2: CDC Communication =========================

bLength : 0x9 (9 bytes)

bDescriptorType : 0x4 Interface

bInterfaceNumber : 0x2

bAlternateSetting : 0x0

bNumEndpoints : 0x1

bInterfaceClass : 0x2 CDC Communication

bInterfaceSubClass : 0x2

bInterfaceProtocol : 0x1

iInterface : 0x6 Error Accessing String

ENDPOINT 0x84: Interrupt IN ==========================

bLength : 0x7 (7 bytes)

bDescriptorType : 0x5 Endpoint

bEndpointAddress : 0x84 IN

bmAttributes : 0x3 Interrupt

wMaxPacketSize : 0x2 (2 bytes)

bInterval : 0xff

INTERFACE 3: CDC Data ==================================

bLength : 0x9 (9 bytes)

bDescriptorType : 0x4 Interface

bInterfaceNumber : 0x3

bAlternateSetting : 0x0

bNumEndpoints : 0x2

bInterfaceClass : 0xa CDC Data

bInterfaceSubClass : 0x0

bInterfaceProtocol : 0x0

iInterface : 0x7 Error Accessing String

ENDPOINT 0x5: Bulk OUT ===============================

bLength : 0x7 (7 bytes)

bDescriptorType : 0x5 Endpoint

bEndpointAddress : 0x5 OUT

bmAttributes : 0x2 Bulk

wMaxPacketSize : 0xe (14 bytes)

bInterval : 0x0

ENDPOINT 0x85: Bulk IN ===============================

bLength : 0x7 (7 bytes)

bDescriptorType : 0x5 Endpoint

bEndpointAddress : 0x85 IN

bmAttributes : 0x2 Bulk

wMaxPacketSize : 0xe (14 bytes)

bInterval : 0x0

>>>

References

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值