Kopete videodevice fixes #34

Merged
blu.256 merged 1 commits from fix/kopete-webcam into master 3 years ago
Collaborator

A number of fixes to Kopete's webcam support.

A number of fixes to Kopete's webcam support.
blu.256 added 5 commits 3 years ago
de18db5805
Adjust video device search paths
ab64ce818e
V4L2 should have priority over older V4L.
c810418f22
Correct handling of V4L and V4L2 code
94bebd7a5c
Fix V4L2 header path
2e265be305
Kopete videodevice: Prevent infinite loop
SlavekB requested changes 3 years ago
SlavekB left a comment
Owner

There is a problem using __LINUX_VIDEODEV2_H see comment.

There is a problem using `__LINUX_VIDEODEV2_H` see comment.
#define CLEAR(x) memset (&(x), 0, sizeof (x))
#define STRINGIZE_(x) #x
#define STRINGIZE(x) STRINGIZE_(x)
Owner

Please, that's really needed? I don't see use in code.

Please, that's really needed? I don't see use in code.
Poster
Collaborator

Sorry, this was accidentally left there from my debugging attempts.

Sorry, this was accidentally left there from my debugging attempts.
blu.256 marked this conversation as resolved
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(ENABLE_AV)
#ifdef V4L2_CAP_VIDEO_CAPTURE
#if defined(__LINUX_VIDEODEV2_H) /* V4L2 */
Owner

It seems to rely on defining __LINUX_VIDEODEV2_H is a problem. There is a layer on FreeBSD that provides compatibility with V4L2 API, but there is defined _UAPI__LINUX_VIDEODEV2_H. Wherein V4L2_CAP_VIDEO_CAPTURE is defined.

It seems to rely on defining `__LINUX_VIDEODEV2_H` is a problem. There is a layer on FreeBSD that provides compatibility with V4L2 API, but there is defined `_UAPI__LINUX_VIDEODEV2_H`. Wherein `V4L2_CAP_VIDEO_CAPTURE` is defined.
blu.256 marked this conversation as resolved
const TQString videodevice_dir_filter=TQString::fromLocal8Bit("video*");
// Check *video* symlinks in /dev/v4l/by-id
const TQString videodevice_dir_path=TQString::fromLocal8Bit("/dev/v4l/by-id/");
Owner

We know what the kernel version has changed this path?

Unfortunately, I do not know what the devices path are used on FreeBSD. Maybe ask Nik on ML.

We know what the kernel version has changed this path? Unfortunately, I do not know what the devices path are used on FreeBSD. Maybe ask Nik on ML.
Poster
Collaborator

This is a change in Udev rules (see note) : https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/open.html#v4l2-device-node-naming

Haven't found yet when precisely the change occured, but probably both cases should be present anyway.

This is a change in Udev rules (see note) : https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/open.html#v4l2-device-node-naming Haven't found yet when precisely the change occured, but probably both cases should be present anyway.
Owner

Ok, I understand if there are not symlinks in /dev/v4l/by-id, will be used /dev/video*, so it should work in all cases, including FreeBSD.

Ok, I understand if there are not symlinks in `/dev/v4l/by-id`, will be used `/dev/video*`, so it should work in all cases, including FreeBSD.
Poster
Collaborator

Based on the little information I could find about using video devices with FreeBSD, it seems to use the "standard" /dev/video? paths. I can confirm the existence of these same paths on Linux.

Probably, due to /dev/video? being common on both Linux and FreeBSD this should be the first guess of Kopete::AVDevice, and if this fails, then it should check the probably-Linux-specific /dev/v4l/by-id/*video*. What do you think?

Based on the little information I could find about using video devices with FreeBSD, it seems to use the "standard" `/dev/video?` paths. I can confirm the existence of these same paths on Linux. Probably, due to `/dev/video?` being common on both Linux and FreeBSD this should be the first guess of Kopete::AVDevice, and if this fails, then it should check the probably-Linux-specific `/dev/v4l/by-id/*video*`. What do you think?
Owner

It seems to me as a good idea to start first with Linux way – symlinks /dev/v4l/by-id/*video* because they can provide better identification of the device for users. And if they are not available as fallback use /dev/video*.

It seems to me as a good idea to start first with Linux way – symlinks `/dev/v4l/by-id/*video*` because they can provide better identification of the device for users. And if they are not available as fallback use `/dev/video*`.
Owner

I think the sensible thing to do is try to detect the avaible path till we find one. I agree with Slavek, start from Linux path first, then BSD, then eventually others.

I think the sensible thing to do is try to detect the avaible path till we find one. I agree with Slavek, start from Linux path first, then BSD, then eventually others.
blu.256 marked this conversation as resolved
Poster
Collaborator

@SlavekB These quick fixes were mostly based on my attempt to get my videocam working with Kopete (it showed a blue box instead) and I'm sure those require some refinement, that is also why I marked the PR as WIP. Thank you for the feedback. I'll get back to this PR when I have the time.

@SlavekB These quick fixes were mostly based on my attempt to get my videocam working with Kopete (it showed a blue box instead) and I'm sure those require some refinement, that is also why I marked the PR as WIP. Thank you for the feedback. I'll get back to this PR when I have the time.
blu.256 added 1 commit 3 years ago
238aafe882
Reverted to V4L2_CAP_VIDEO_CAPTURE for V4L2 detection.
Owner

Great, looking forward for this. I also had a blue box, I remember

Great, looking forward for this. I also had a blue box, I remember
blu.256 changed title from WIP: Kopete videodevice fixes to Kopete videodevice fixes 3 years ago
blu.256 force-pushed fix/kopete-webcam from 238aafe882 to de786a075b 3 years ago
blu.256 merged commit de786a075b into master 3 years ago
blu.256 deleted branch fix/kopete-webcam 3 years ago
SlavekB approved these changes 3 years ago
SlavekB left a comment
Owner

Good work, thank you.

Good work, thank you.
Owner

Just for info, in Kopete -> Configure Kopete -> Devices tab, do you see any picture from the camera? I am testing in a VB box and I see just a black square, but I guess it could be because of VB. Just trying to undertand better.

Just for info, in Kopete -> Configure Kopete -> Devices tab, do you see any picture from the camera? I am testing in a VB box and I see just a black square, but I guess it could be because of VB. Just trying to undertand better.
Poster
Collaborator

Yes with the fix I see the picture from my webcam. Before that it did not find any device (drop down menu was empty) and showed a blue box.

Yes with the fix I see the picture from my webcam. Before that it did not find any device (drop down menu was empty) and showed a *blue* box.
Owner

I look forward to trying it today on my Pine 😺

I look forward to trying it today on my Pine 😺
Owner

Yes with the fix I see the picture from my webcam. Before that it did not find any device (drop down menu was empty) and showed a blue box.

I do see a VB camera in the drop down now, but no picture. But as said, it could be virtual box. I will try on another laptop where TDE is installed directly and see how it goes.

> Yes with the fix I see the picture from my webcam. Before that it did not find any device (drop down menu was empty) and showed a *blue* box. I do see a VB camera in the drop down now, but no picture. But as said, it could be virtual box. I will try on another laptop where TDE is installed directly and see how it goes.
Owner

Tested on another laptop, works great!! Good work Philippe!!

Tested on another laptop, works great!! Good work Philippe!!
Owner

I can confirm that on my Pine video now works! Although I don't know why two USB Camera devices are shown, but it is a matter between hardware and kernel 😺

I can confirm that on my Pine video now works! Although I don't know why two USB Camera devices are shown, but it is a matter between hardware and kernel 😺
Poster
Collaborator

Interestingly, it also showed two devices for me. /dev/v4l/by-id/ does in fact contain two devices for the same webcam (not sure why V4L2 does this). The difference between them seems to be, according to debug output from Kopete, that the second one does not have any controls (brightness, gamma, etc.), at least in my case.

Interestingly, it also showed two devices for me. /dev/v4l/by-id/ does in fact contain two devices for the same webcam (not sure why V4L2 does this). The difference between them seems to be, according to debug output from Kopete, that the second one does not have any controls (brightness, gamma, etc.), at least in my case.
Owner

I also have two devices, and if I try to select the second one I get a SEGV, both in VB and in the real laptop....

I also have two devices, and if I try to select the second one I get a SEGV, both in VB and in the real laptop....
Owner

There was also a crash when I chose the second device. Obviously it is not the unusual behavior of my hardware and we should deal with it. For example, find the capabilities of device and exclude from the list that is not possible to use?

There was also a crash when I chose the second device. Obviously it is not the unusual behavior of my hardware and we should deal with it. For example, find the capabilities of device and exclude from the list that is not possible to use?
Poster
Collaborator

Probably yes. Initially I though that it was just my camera, but it seems to be commonplace. I'll try finding a solution when I find time for this.

Probably yes. Initially I though that it was just my camera, but it seems to be commonplace. I'll try finding a solution when I find time for this.
Poster
Collaborator
Probably relevant: https://unix.stackexchange.com/questions/512759/multiple-dev-video-for-one-physical-device
SlavekB added this to the R14.0.11 release milestone 3 years ago

Reviewers

SlavekB approved these changes 3 years ago
The pull request has been merged as de786a075b.
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
3 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: TDE/tdenetwork#34
Loading…
There is no content yet.