Skip to content

Commit

Permalink
Graceful handling of missing bcdDevice
Browse files Browse the repository at this point in the history
  • Loading branch information
krichardsson committed May 30, 2023
1 parent 15fee7a commit e9d5972
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cflib/drivers/cfusb.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ def __init__(self, device=None, devid=0):
self.dev.set_configuration()

self.handle = self.dev
self.version = float(
'{0:x}.{1:x}'.format(self.dev.bcdDevice >> 8,
self.dev.bcdDevice & 0x0FF))
if self.dev:
self.version = float('{0:x}.{1:x}'.format(self.dev.bcdDevice >> 8, self.dev.bcdDevice & 0x0FF))
else:
self.version = 0.0

def get_serial(self):
# The signature for get_string has changed between versions to 1.0.0b1,
Expand Down

0 comments on commit e9d5972

Please sign in to comment.