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

Lines changed: 2 additions & 1 deletion
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy