circuitpython/tests/circuitpython-manual/usb/device_info.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
525 B
Python
Raw Normal View History

import usb_host
import board
import digitalio
import usb.core
import time
if hasattr(board, "USB_HOST_POWER"):
d = digitalio.DigitalInOut(board.USB_HOST_POWER)
d.switch_to_output(value=True)
print("USB power on")
h = usb_host.Port(board.USB_HOST_DP, board.USB_HOST_DM)
while True:
for device in usb.core.find(find_all=True):
2022-03-11 13:51:50 -05:00
print(f"{device.idVendor:04x}:{device.idProduct:04x}")
print(device.manufacturer, device.product)
print(device.serial_number)
print()
time.sleep(10)