move args.hid check into main(). It has nothing to do in write()

rebase020124
Juergen Weigert 11 months ago
parent 5f5340fb29
commit 105e23b187
  1. 6
      lednamebadge.py

@ -559,8 +559,6 @@ or
LedNameBadge.pyhidapi.hid_write(dev, sendbuf)
LedNameBadge.pyhidapi.hid_close(dev)
else:
if args.hid != "0":
sys.exit("HID API access is needed but not initialized. Fix your setup")
dev = LedNameBadge.usb.core.find(idVendor=0x0416, idProduct=0x5020)
if dev is None:
print("No led tag with vendorID 0x0416 and productID 0x5020 found.")
@ -662,6 +660,10 @@ def main():
for msg_bitmap in msg_bitmaps:
buf.extend(msg_bitmap[0])
if not LedNameBadge._have_pyhidapi:
if args.hid != "0":
sys.exit("HID API access is needed but not initialized. Fix your setup")
LedNameBadge.write(buf)

Loading…
Cancel
Save