Skip to content

Commit 8afdccc

Browse files
committed
check if pins exist before using
1 parent 68561fc commit 8afdccc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tests/circuitpython-manual/usb/device_info.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
d.switch_to_output(value=True)
1010
print("USB power on")
1111

12-
h = usb_host.Port(board.USB_HOST_DP, board.USB_HOST_DM)
12+
if hasattr(board, "USB_HOST_DP") and hasattr(board, "USB_HOST_DM"):
13+
h = usb_host.Port(board.USB_HOST_DP, board.USB_HOST_DM)
1314

1415
while True:
1516
for device in usb.core.find(find_all=True):

0 commit comments

Comments
 (0)