Skip to content

Commit

Permalink
fix device id/enumeration on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
jveitchmichaelis committed May 18, 2020
1 parent 9a35fb1 commit 8368009
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions flirpy/camera/boson.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,15 @@ def find_video_device(self):
path = "/sys/class/video4linux/"
video_devices = [os.path.join(path, device) for device in os.listdir(path)]
dev = []
for i, device in enumerate(video_devices):
for device in video_devices:
udev = pyudev.Devices.from_path(context, device)

try:
vid= udev.properties['ID_VENDOR_ID']
pid = udev.properties['ID_MODEL_ID']

if vid.lower() == "09cb" and pid == "4007":
dev.append(i)
if vid.lower() == "09cb" and pid.lower() == "4007":
dev.append(int(device.split('video')[-1]))
except KeyError:
pass

Expand Down
4 changes: 2 additions & 2 deletions flirpy/camera/lepton.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ def find_video_device(self):
path = "/sys/class/video4linux/"
video_devices = [os.path.join(path, device) for device in os.listdir(path)]
dev = []
for i, device in enumerate(video_devices):
for device in video_devices:
udev = pyudev.Devices.from_path(context, device)

try:
vid= udev.properties['ID_VENDOR_ID']
pid = udev.properties['ID_MODEL_ID']

if vid.lower() == "1e4e" and pid.lower() == "0100":
dev.append(i)
dev.append(int(device.split('video')[-1]))
except KeyError:
pass

Expand Down

0 comments on commit 8368009

Please sign in to comment.