forked from jnohlgard/python-v4l2capture
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist_devices.py
executable file
·28 lines (27 loc) · 932 Bytes
/
list_devices.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/python
#
# python-v4l2capture
#
# 2009, 2010 Fredrik Portstrom
#
# I, the copyright holder of this file, hereby release it into the
# public domain. This applies worldwide. In case this is not legally
# possible: I grant anyone the right to use this work for any
# purpose, without any conditions, unless such conditions are
# required by law.
import os
import v4l2capture
file_names = [x for x in os.listdir("/dev") if x.startswith("video")]
file_names.sort()
for file_name in file_names:
path = "/dev/" + file_name
print path
try:
video = v4l2capture.Video_device(path)
driver, card, bus_info, capabilities = video.get_info()
print " driver: %s\n card: %s" \
"\n bus info: %s\n capabilities: %s" % (
driver, card, bus_info, ", ".join(capabilities))
video.close()
except IOError, e:
print " " + str(e)