Skip to content

Commit 12ef999

Browse files
committed
utils: Updates test scrip to use videodev2
This replaces the now unused v4l2 python library. Signed-off-by: Naushir Patuck <[email protected]>
1 parent 61fba02 commit 12ef999

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

utils/test.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,24 @@
2020
import subprocess
2121
import sys
2222
from timeit import default_timer as timer
23-
import v4l2
23+
import videodev2
2424
import numpy as np
2525

2626

2727
def get_platform():
2828
platform = 'vc4'
2929
try:
30-
for num in range(5):
30+
for num in range(64):
3131
device = '/dev/video' + str(num)
3232
if os.path.exists(device):
3333
with open(device, 'rb+', buffering=0) as fd:
34-
caps = v4l2.v4l2_capability()
35-
fcntl.ioctl(fd, v4l2.VIDIOC_QUERYCAP, caps)
36-
decoded = caps.card.decode('utf-8')
37-
if decoded == 'rp1-cfe':
34+
caps = videodev2.v4l2_capability()
35+
fcntl.ioctl(fd, videodev2.VIDIOC_QUERYCAP, caps)
36+
decoded = videodev2.arr_to_str(caps.card)
37+
if decoded == "pispbe":
3838
platform = 'pisp'
3939
break
40-
elif decoded == 'unicam':
40+
elif decoded == "unicam":
4141
break
4242
except Exception:
4343
pass

0 commit comments

Comments
 (0)