linuxtrack icon indicating copy to clipboard operation
linuxtrack copied to clipboard

Problem with preview in tracking windows

Open benoitjy opened this issue 6 years ago • 11 comments

Hi,

Come back again, with a problem... I'm on debian testing. I try to use Linuxtrack 0.99.18-32 and 0.99.19hid-32, same problem. When i press "start" button, something goes wrong

here is the log ("start" press at [Sat 2018-09-29 11:11:44 CEST]) : `[Sat 2018-09-29 11:11:16 CEST] ================================================ [Sat 2018-09-29 11:11:16 CEST] Opening logfile viewer. [Sat 2018-09-29 11:11:16 CEST] Launching wine command: '"wine" "--version"' [Sat 2018-09-29 11:11:16 CEST] Going to create lock '/home/benoit/.config/linuxtrack/ltr_server.lock' => 18! [Sat 2018-09-29 11:11:16 CEST] Lock 18 success! [Sat 2018-09-29 11:11:16 CEST] Passing the lock to protect fifo (pid 7090)! [Sat 2018-09-29 11:11:16 CEST] Initializing axes for profile 'Default'! [Sat 2018-09-29 11:11:16 CEST] Closing axes! [Sat 2018-09-29 11:11:16 CEST] Initializing axes for profile 'Default'! [Sat 2018-09-29 11:11:16 CEST] Closing axes! [Sat 2018-09-29 11:11:16 CEST] Initializing axes for profile 'Default'! [Sat 2018-09-29 11:11:16 CEST] Closing axes! [Sat 2018-09-29 11:11:16 CEST] Initializing axes for profile 'Default'! [Sat 2018-09-29 11:11:16 CEST] Launching wine command: '"wine" "--version"' [Sat 2018-09-29 11:11:16 CEST] Initializing libusb. [Sat 2018-09-29 11:11:16 CEST] Libusb initialized successfuly. [Sat 2018-09-29 11:11:16 CEST] Libusb debug level set. [Sat 2018-09-29 11:11:16 CEST] Requesting device list. [Sat 2018-09-29 11:11:16 CEST] Device list received (11 devices). [Sat 2018-09-29 11:11:16 CEST] Can't find any TrackIR! [Sat 2018-09-29 11:11:16 CEST] Freeing device list. [Sat 2018-09-29 11:11:16 CEST] Device list freed. [Sat 2018-09-29 11:11:16 CEST] Bad handle! [Sat 2018-09-29 11:11:16 CEST] Closing TrackIR. [Sat 2018-09-29 11:11:16 CEST] Closing TrackIR handle. [Sat 2018-09-29 11:11:16 CEST] Exiting libusb. [Sat 2018-09-29 11:11:16 CEST] Libusb exited. [Sat 2018-09-29 11:11:16 CEST] Initializing libusb. [Sat 2018-09-29 11:11:16 CEST] Libusb initialized successfuly. [Sat 2018-09-29 11:11:16 CEST] Libusb debug level set. [Sat 2018-09-29 11:11:16 CEST] Requesting device list. [Sat 2018-09-29 11:11:16 CEST] Device list received (11 devices). [Sat 2018-09-29 11:11:16 CEST] Can't find any Ps3 Eye! [Sat 2018-09-29 11:11:16 CEST] Freeing device list. [Sat 2018-09-29 11:11:16 CEST] Device list freed. [Sat 2018-09-29 11:11:16 CEST] Bad handle! [Sat 2018-09-29 11:11:16 CEST] Closing TrackIR. [Sat 2018-09-29 11:11:16 CEST] Closing TrackIR handle. [Sat 2018-09-29 11:11:16 CEST] Exiting libusb. [Sat 2018-09-29 11:11:16 CEST] Libusb exited. [Sat 2018-09-29 11:11:16 CEST] Initializing libusb. [Sat 2018-09-29 11:11:16 CEST] Libusb initialized successfuly. [Sat 2018-09-29 11:11:16 CEST] Libusb debug level set. [Sat 2018-09-29 11:11:16 CEST] Requesting device list. [Sat 2018-09-29 11:11:16 CEST] Device list received (11 devices). [Sat 2018-09-29 11:11:16 CEST] Can't find any Ps3 Eye! [Sat 2018-09-29 11:11:16 CEST] Freeing device list. [Sat 2018-09-29 11:11:16 CEST] Device list freed. [Sat 2018-09-29 11:11:16 CEST] Bad handle! [Sat 2018-09-29 11:11:16 CEST] Closing TrackIR. [Sat 2018-09-29 11:11:16 CEST] Closing TrackIR handle. [Sat 2018-09-29 11:11:16 CEST] Exiting libusb. [Sat 2018-09-29 11:11:16 CEST] Libusb exited. [Sat 2018-09-29 11:11:16 CEST] Found V4L2 webcam: 'UVC Camera (046d:0825)' [Sat 2018-09-29 11:11:17 CEST] Found V4L2 webcam: 'UVC Camera (046d:0825)' [Sat 2018-09-29 11:11:17 CEST] Found V4L2 webcam: 'UVC Camera (046d:0825)' [Sat 2018-09-29 11:11:17 CEST] Found V4L2 webcam: 'UVC Camera (046d:0825)' [Sat 2018-09-29 11:11:17 CEST] open: Permission denied [Sat 2018-09-29 11:11:17 CEST] open: Permission denied [Sat 2018-09-29 11:11:17 CEST] open: Permission denied [Sat 2018-09-29 11:11:17 CEST] open: Permission denied [Sat 2018-09-29 11:11:17 CEST] open: Permission denied [Sat 2018-09-29 11:11:17 CEST] open: Permission denied [Sat 2018-09-29 11:11:17 CEST] open: Permission denied [Sat 2018-09-29 11:11:17 CEST] open: Permission denied [Sat 2018-09-29 11:11:17 CEST] open: Permission denied [Sat 2018-09-29 11:11:17 CEST] open: Permission denied [Sat 2018-09-29 11:11:17 CEST] open: Permission denied [Sat 2018-09-29 11:11:17 CEST] open: Permission denied [Sat 2018-09-29 11:11:17 CEST] open: Permission denied [Sat 2018-09-29 11:11:17 CEST] open: Permission denied [Sat 2018-09-29 11:11:17 CEST] open: Permission denied [Sat 2018-09-29 11:11:17 CEST] open: Permission denied [Sat 2018-09-29 11:11:17 CEST] open: Permission denied [Sat 2018-09-29 11:11:17 CEST] open: Permission denied [Sat 2018-09-29 11:11:17 CEST] Found V4L2 webcam: 'UVC Camera (046d:0825)' [Sat 2018-09-29 11:11:17 CEST] Found webcam 'video1' (/dev/video1)

[Sat 2018-09-29 11:11:44 CEST] Lock 18 success! [Sat 2018-09-29 11:11:44 CEST] Socket created! [Sat 2018-09-29 11:11:44 CEST] Other master gave up, gui master taking over! [Sat 2018-09-29 11:11:44 CEST] Starting as master! [Sat 2018-09-29 11:11:44 CEST] Initializing model! [Sat 2018-09-29 11:11:44 CEST] Tracking initialized! [Sat 2018-09-29 11:11:44 CEST] Adding fd 25 [Sat 2018-09-29 11:11:44 CEST] Device Type: Webcam - facetrack [Sat 2018-09-29 11:11:44 CEST] Changing state to INITIALIZING! [Sat 2018-09-29 11:11:44 CEST] Loading library 'libft' [Sat 2018-09-29 11:11:44 CEST] Running! [Sat 2018-09-29 11:11:44 CEST] Changing state to INITIALIZING! [Sat 2018-09-29 11:11:44 CEST] Found V4L2 webcam: 'UVC Camera (046d:0825)' [Sat 2018-09-29 11:11:44 CEST] Found webcam 'video1' (/dev/video1) [Sat 2018-09-29 11:11:44 CEST] Using wrong data to switch formats! [Sat 2018-09-29 11:11:44 CEST] Couldn't set capture format! [Sat 2018-09-29 11:11:44 CEST] Problem initializing tracker! [Sat 2018-09-29 11:11:44 CEST] Changing state to ERROR!

[Sat 2018-09-29 11:11:46 CEST] Shutting down tracking! [Sat 2018-09-29 11:11:46 CEST] Shutting down tracking... [Sat 2018-09-29 11:11:46 CEST] Calling shutdown without initializing first! [Sat 2018-09-29 11:11:46 CEST] Master closing socket 25 [Sat 2018-09-29 11:11:46 CEST] Closing semaphore 18 (pid 7090)! [Sat 2018-09-29 11:11:46 CEST] Tracker not stopped yet, waiting for the stop...

[Sat 2018-09-29 11:11:47 CEST] Tracker not stopped yet, waiting for the stop... ` And i don't know how to solve... Could you help me?

benoitjy avatar Sep 29 '18 09:09 benoitjy

nothing? Really? Please... é_è

benoitjy avatar Oct 22 '18 18:10 benoitjy

@benoitjy Could you check if there's two /dev/video* devices?

I have the same webcam (Logitech C270) and ran into a similar problem. For some reason it shows up as two devices: /dev/video0 and /dev/video1 and linuxtrack uses the wrong one. The quick-and-dirty fix i used was to change the permissions on /dev/video1 (sudo chmod a= /dev/video1) so that it cannot be accessed and will be skipped by linuxtrack. This resulted in linuxtrack using /dev/video0 and working.

In the menu of ltr_gui the webcam gets listed twice, so it's probably seeing both devices. I'm guessing since they're labeled the same, only one can be chosen (and in my/our case, the wrong one). I had a look at webcam_driver.c, and found it uses VIDIOC_QUERYCAP for getting the webcam label. The V4L2 api documentation mentions the following:

Since multiple TV cards of the same brand may be installed which are supported by the same driver, this name should be combined with the character device file name (e. g. /dev/video2) or the bus_info string to avoid ambiguities.

So the proper fix is to add (append?) either the device file name or the bus_info field. The latter would probably be the easier fix, as it's already available from the capability variable in the function. Were as the filename would have to be passed in to it.

pwerken avatar Jan 11 '19 09:01 pwerken

Hi

thanks for your answer. This is the point! I've find 2 /dev/video*, and when i try with another camera, it works. But, when i try to change rights on /dev/video1 (or video0, the same), camera disapear from linuxtrack. I will try to find why debian is mounting 2 cameras. Or i'll buy another webcam...

B J

Le 11/01/2019 à 10:18, Peter van de Werken a écrit :

@benoitjy https://github.com/benoitjy Could you check if there's two |/dev/video*| devices?

I have the same webcam (Logitech C270) and ran into a similar problem. For some reason it shows up as two devices: |/dev/video0| and |/dev/video1| and linuxtrack uses the wrong one. The quick-and-dirty fix i used was to change the permissions on |/dev/video1| (|sudo chmod a= /dev/video1|) so that it cannot be accessed and will be skipped by linuxtrack. This resulted in linuxtrack using |/dev/video0| and working.

In the menu of ltr_gui the webcam gets listed twice, so it's probably seeing both devices. I'm guessing since they're labeled the same, only one can be chosen (and in my/our case, the wrong one). I had a look at |webcam_driver.c|, and found it uses VIDIOC_QUERYCAP https://github.com/uglyDwarf/linuxtrack/blob/2b4817cb48e34b1cb5b9045687221644ece4d966/src/webcam_driver.c#L70 for getting the webcam label. The V4L2 api documentation https://www.kernel.org/doc/html/v4.9/media/uapi/v4l/vidioc-querycap.html mentions the following:

Since multiple TV cards of the same brand may be installed which
are supported by the same driver, this name should be combined
with the character device file name (e. g. /dev/video2) or the
bus_info string to avoid ambiguities.

So the proper fix is to add (append?) either the device file name or the bus_info field. The latter would probably be the easier fix, as it's already available from the |capability| variable in the function. Were as the filename would have to be passed in to it.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/uglyDwarf/linuxtrack/issues/147#issuecomment-453445579, or mute the thread https://github.com/notifications/unsubscribe-auth/Apkb7sV57_rU9XGDM2kwTXv3Lq4pH_kSks5vCFb0gaJpZM4XAa43.

benoitjy avatar Jan 13 '19 09:01 benoitjy

Hello, I'm sorry for not chiming in sooner... I'd try different pixel format - the error message is caused to set the capture format (the resolution or pixel format or their combination is invalid for some reason)... Kind regards, Michal

uglyDwarf avatar Jan 21 '19 21:01 uglyDwarf

Hi,

I'll make a pull-request for adding the device name to the webcam name in order to make it unique as is suggested in the V4L2 api. This makes ltr_gui list both video devices and allows me to select the correct one.

I tried the different pixel format, but none seem to work on /dev/video1. On /dev/video0 they do work.

Just had look at what v4l2-ctl reports on the webcam devices. Don't really know what to look for. Mind you, I only have one webcam, I don't know why the driver reports it as two /dev/video devices.

v4l2-ctl device information on both /dev/video0 and /dev/video1
$ v4l2-ctl --list-devices           UVC Camera (046d:0825) (usb-0000:00:14.0-5):
        /dev/video0
        /dev/video1

$ v4l2-ctl --info --device /dev/video0
Driver Info:
        Driver name      : uvcvideo
        Card type        : UVC Camera (046d:0825)
        Bus info         : usb-0000:00:14.0-5
        Driver version   : 4.19.12
        Capabilities     : 0x84a00001
                Video Capture
                Metadata Capture
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps      : 0x04200001
                Video Capture
                Streaming
                Extended Pix Format
Media Driver Info:
        Driver name      : uvcvideo
        Model            : UVC Camera (046d:0825)
        Serial           : 2F149CE0
        Bus info         : 5
        Media version    : 4.19.12
        Hardware revision: 0x00000012 (18)
        Driver version   : 4.19.12
Interface Info:
        ID               : 0x03000002
        Type             : V4L Video
Entity Info:
        ID               : 0x00000001 (1)
        Name             : UVC Camera (046d:0825)
        Function         : V4L2 I/O
        Flags         : default
        Pad 0x01000007   : 0: Sink
          Link 0x02000019: from remote pad 0x100000a of entity 'Extension 4': Data, Enabled, Immutable
$ v4l2-ctl --list-ctrls --device /dev/video0
                     brightness 0x00980900 (int)    : min=0 max=255 step=1 default=128 value=128
                       contrast 0x00980901 (int)    : min=0 max=255 step=1 default=32 value=32
                     saturation 0x00980902 (int)    : min=0 max=255 step=1 default=32 value=32
 white_balance_temperature_auto 0x0098090c (bool)   : default=1 value=1
                           gain 0x00980913 (int)    : min=0 max=255 step=1 default=64 value=64
           power_line_frequency 0x00980918 (menu)   : min=0 max=2 default=2 value=2
      white_balance_temperature 0x0098091a (int)    : min=0 max=10000 step=10 default=4000 value=4000 flags=inactive
                      sharpness 0x0098091b (int)    : min=0 max=255 step=1 default=24 value=24
         backlight_compensation 0x0098091c (int)    : min=0 max=1 step=1 default=0 value=0
                  exposure_auto 0x009a0901 (menu)   : min=0 max=3 default=3 value=3
              exposure_absolute 0x009a0902 (int)    : min=1 max=10000 step=1 default=166 value=166 flags=inactive
         exposure_auto_priority 0x009a0903 (bool)   : default=0 value=1
$ v4l2-ctl --info --device /dev/video1
Driver Info:
        Driver name      : uvcvideo
        Card type        : UVC Camera (046d:0825)
        Bus info         : usb-0000:00:14.0-5
        Driver version   : 4.19.12
        Capabilities     : 0x84a00001
                Video Capture
                Metadata Capture
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps      : 0x04a00000
                Metadata Capture
                Streaming
                Extended Pix Format
Media Driver Info:
        Driver name      : uvcvideo
        Model            : UVC Camera (046d:0825)
        Serial           : 2F149CE0
        Bus info         : 5
        Media version    : 4.19.12
        Hardware revision: 0x00000012 (18)
        Driver version   : 4.19.12
Interface Info:
        ID               : 0x03000005
        Type             : V4L Video
Entity Info:
        ID               : 0x00000004 (4)
        Name             : UVC Camera (046d:0825)
        Function         : V4L2 I/O
$ v4l2-ctl --list-ctrls --device /dev/video1
$

cheers, Peter

pwerken avatar Jan 24 '19 17:01 pwerken

Hello Peter, May I ask you to attach also the dump of lsusb -v for the webcam? It looks like the camera acts as two different devices (note the different Device caps)... As for the patch, thank you for the effort, but I'm afraid that it could cause more problems in the long run - if for some reason the devices enumerate in the different order, or another video device gets connected and these two get shifted, it will break... Please let me think about it for a bit... Kind regards, Michal

uglyDwarf avatar Jan 24 '19 19:01 uglyDwarf

Gist with the output of lsusb -v.

cheers, Peter

pwerken avatar Jan 24 '19 19:01 pwerken

Got a similar problem here, with my Logitech C930e. Haven't flown the flight sim in a week or so, and something I've done in the meanwhile has broken ltr's recognition of the webcam. Updated kernel, maybe? On 4.19.37 now.

Changing the permissions on /dev/video1 didn't resolve it for me... only one instance of the camera shows up in ltr_gui, but it doesn't give all the normal options for the webcam: resolution, etc.

Oddly enough, qv4l2 sees the webcam perfectly fine, and will pull video from it without an issue. I do note that it's listing the device as /dev/video0 (wrapped)... maybe that "wrapped" bit has something to do with it?

Update: Definitely caused by a kernel update. Reverted back to 4.14.120, and only one video device node is populating for the webcam. Makes me wonder what's changed in the uvcvideo driver...

theluckyone17 avatar May 21 '19 01:05 theluckyone17

Hi,

with a new install of debian testing, i've always same problem. michal, have you planned new versions, can we hope to have an evolution, we poor debianist, who allow us to use this great program? I would like to be competent enough to help, but ...

benoitjy avatar Nov 21 '19 23:11 benoitjy

This might provide some insight: media: uvcvideo: Add a metadata device node: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=088ead25524583e2200aa99111bea2f66a86545a

Post discussing the patch: https://unix.stackexchange.com/questions/512759/multiple-dev-video-for-one-physical-device

theluckyone17 avatar Nov 28 '19 15:11 theluckyone17

Oh, yes, thank you. I'll take a look.

edit: ok, as i understand it, the better way is that linuxtrack can filter metadata device node, no?

benoitjy avatar Dec 02 '19 10:12 benoitjy