-
Notifications
You must be signed in to change notification settings - Fork 5
v4l2 sub-device queries. #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Additionally, if I change the In [3]: dev.open()
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In [3], line 1
----> 1 dev.open()
File ~/.local/lib/python3.11/site-packages/linuxpy/device.py:116, in BaseDevice.open(self)
114 self.log.info("opening %s", self.filename)
115 self._fobj = self.io.open(self.filename, self._read_write)
--> 116 self._on_open()
117 self.log.info("opened %s", self.filename)
File ~/.local/lib/python3.11/site-packages/linuxpy/video/device.py:759, in Device._on_open(self)
757 def _on_open(self):
758 self.info = read_info(self.fileno())
--> 759 self.controls = Controls.from_device(self)
File ~/.local/lib/python3.11/site-packages/linuxpy/video/device.py:888, in Controls.from_device(cls, device)
886 ctrl_type = ControlType(ctrl.type)
887 ctrl_class = ctrl_type_map.get(ctrl_type, GenericControl)
--> 888 ctrl_dict[ctrl.id] = ctrl_class(device, ctrl)
890 return cls(ctrl_dict)
File ~/.local/lib/python3.11/site-packages/linuxpy/video/device.py:1222, in MenuControl.__init__(self, device, info)
1220 self.data = {item.index: item.name.decode() for item in iter_read_menu(self.device._fobj, self)}
1221 elif self.type == ControlType.INTEGER_MENU:
-> 1222 self.data = {item.index: int(item.name) for item in iter_read_menu(self.device._fobj, self)}
1223 else:
1224 raise TypeError(f"MenuControl only supports control types MENU or INTEGER_MENU, but not {self.type.name}")
File ~/.local/lib/python3.11/site-packages/linuxpy/video/device.py:1222, in <dictcomp>(.0)
1220 self.data = {item.index: item.name.decode() for item in iter_read_menu(self.device._fobj, self)}
1221 elif self.type == ControlType.INTEGER_MENU:
-> 1222 self.data = {item.index: int(item.name) for item in iter_read_menu(self.device._fobj, self)}
1223 else:
1224 raise TypeError(f"MenuControl only supports control types MENU or INTEGER_MENU, but not {self.type.name}")
ValueError: invalid literal for int() with base 10: b'' I'm also happy to provide any further details that may be required, if these issues are within the scope of the project. |
Thanks for reporting. I just checked with vivid in #24 but unfortunately it doesn't have sub-device support yet. Please let me know if #24 fixes your problem |
My bad, I should've been more clear with my phrasing. In this case I was referring to a second error that was raised after I had hard-coded the I thought it may have been fixed by this commit: 5bd1412 (in #24). Sorry for the confusion, I'm probably relating two separate issues in this case. |
At this point the library doesn't support v4l2 sub-devices. FYI, #24 was merged into master |
Yes, I am creating the device explicitly with In terms of hardware it's a Raspberry Pi 5 with a specific sensor. I don't think it'll help much unfortunately, but it's this one in particular: https://wiki.veye.cc/index.php/MV-MIPI-IMX287M_Index. I'm not sure if these will help, but I've attached the output of some commands too:
Regarding #24, the error is slightly different but I believe still fails in the same place: File ~/Documents/linuxpy/linuxpy/video/device.py:1424, in <dictcomp>(.0)
1422 self.data = {item.index: item.name.decode() for item in iter_read_menu(self.device._fobj, self)}
1423 elif self.type == ControlType.INTEGER_MENU:
-> 1424 self.data = {item.index: ord(item.name) for item in iter_read_menu(self.device._fobj, self)}
1425 else:
1426 raise TypeError(f"MenuControl only supports control types MENU or INTEGER_MENU, but not {self.type.name}")
TypeError: ord() expected a character, but string of length 0 found I will look more into the the |
So with the
Upon looking into this line: self.data = {item.index: item.value for item in iter_read_menu(self.device._fobj, self)} fixes the issue for me ( Also, I can put this under a separate issue if you want, as it doesn't seem to be related to querying sub-devices. |
yes, looks like the correct fix. |
The library doesn't seem to be able to query v4l2 sub-devices.
When attempting to do so, I believe the wrong
ioctl
call is used (VIDIOC_QUERYCAP
vsVIDIOC_SUBDEV_QUERYCAP
).The line in question is: https://github.com/tiagocoutinho/linuxpy/blob/master/linuxpy/video/device.py#L262
I've also included the full error:
P.S.
Thanks for the great library, it's a real help :)
The text was updated successfully, but these errors were encountered: