mkalten / reacTIVision

computer vision framework for tangible interactive surfaces
Other
306 stars 65 forks source link

No camera found on SUR40 with Ubuntu 20.04 #41

Closed kikelkik closed 2 years ago

kikelkik commented 2 years ago

Hi, I try for a few days to setup reacTIVision with a SUR40 with a fresh installed Ubuntu 20.04 (Kernel: 5.13.0-41-generic ). But reacTIVision does not find any camera. I figured out that /dev/video0 did not exist but /dev/v4l-touch0 , so I created /dev/video0 as a symlink so that it could be found as a camera by v4l2-ctl (see below). Touch is working out of the box.

Output reacTIVision 1.5.1 (latest amd64 .deb release from http://reactivision.sourceforge.net/):

$ reacTIVision 
reacTIVision 1.5.1 (May 18 2016)

no DC1394 cameras found
Error loading camera configuration file: default
1 V4Linux2 device found
VIDIOC_REQBUFS: Cannot allocate memory
Error requesting buffers.
could not initialize camera
render: opengl

Output reacTIVision 1.6 (compiled from latest commit on master):

$ ./reacTIVision 
reacTIVision 1.6 (May 12 2022)

VIDIOC_REQBUFS: Cannot allocate memory
Error requesting buffers.
could not initialize selected camera
VIDIOC_REQBUFS: Cannot allocate memory
Error requesting buffers.
could not initialize default camera
TUIO/UDP messages to 127.0.0.1@3333
TUIO/TCP socket created on port 3333
TUIO/WEB socket created on port 8080
TUIO/FLC receiveOscData@_OscDataStream
tuio/src rtv@127.0.1.1
render: opengl

v4l2-ctl info:

$ v4l2-ctl --list-devices
Samsung SUR40 (usb-0000:00:13.2-1):
    /dev/v4l-touch0

Cannot open device /dev/video0, exiting.
$ v4l2-ctl --device=/dev/v4l-touch0 --all
Driver Info:
    Driver name      : sur40
    Card type        : Samsung SUR40
    Bus info         : usb-0000:00:13.2-1
    Driver version   : 5.13.19
    Capabilities     : 0x95200001
        Video Capture
        Touch Device
        Read/Write
        Streaming
        Extended Pix Format
        Device Capabilities
    Device Caps      : 0x15200001
        Video Capture
        Touch Device
        Read/Write
        Streaming
        Extended Pix Format
Priority: 2
Video input : 0 (In-Cell Sensor: ok)
Format Video Capture:
    Width/Height      : 960/540
    Pixel Format      : 'TU08' (8-bit Unsigned Touch Data)
    Field             : None
    Bytes per Line    : 960
    Size Image        : 518400
    Colorspace        : Raw
    Transfer Function : Default (maps to None)
    YCbCr/HSV Encoding: Default (maps to ITU-R 601)
    Quantization      : Default (maps to Full Range)
    Flags             :
Streaming Parameters Video Capture:
    Capabilities     : timeperframe
    Frames per second: 60.000 (60/1)
    Read buffers     : 3

User Controls

                     brightness 0x00980900 (int)    : min=0 max=255 step=1 default=255 value=255 flags=slider
                       contrast 0x00980901 (int)    : min=0 max=15 step=1 default=10 value=10 flags=slider
                           gain 0x00980913 (int)    : min=0 max=9 step=1 default=8 value=8
         backlight_compensation 0x0098091c (int)    : min=0 max=1 step=1 default=1 value=1

The sur40 kernel module is loaded but I'm worried about "Samsung SUR40: device removed":

May 12 17:56:13 livingplace-sur40 kernel: [ 6640.391458] mc: Linux media interface: v0.10
May 12 17:56:13 livingplace-sur40 kernel: [ 6640.400810] videodev: Linux video capture interface: v2.00
May 12 17:56:13 livingplace-sur40 kernel: [ 6640.417271] input: Samsung SUR40 as /devices/pci0000:00/0000:00:13.2/usb2/2-1/2-1:1.0/input/input14
May 12 17:56:14 livingplace-sur40 kernel: [ 6641.219959] usbcore: registered new interface driver sur40
May 12 17:56:14 livingplace-sur40 /usr/lib/gdm3/gdm-x-session[735]: (II) config/udev: Adding input device Samsung SUR40 (/dev/input/mouse1)
May 12 17:56:14 livingplace-sur40 /usr/lib/gdm3/gdm-x-session[735]: (II) No input driver specified, ignoring this device.
May 12 17:56:14 livingplace-sur40 /usr/lib/gdm3/gdm-x-session[735]: (II) This device may have been added with another device file.
May 12 17:56:14 livingplace-sur40 /usr/lib/gdm3/gdm-x-session[735]: (II) config/udev: Adding input device Samsung SUR40 (/dev/input/event6)
May 12 17:56:14 livingplace-sur40 /usr/lib/gdm3/gdm-x-session[735]: (**) Samsung SUR40: Applying InputClass "libinput touchscreen catchall"
May 12 17:56:14 livingplace-sur40 /usr/lib/gdm3/gdm-x-session[735]: (II) Using input driver 'libinput' for 'Samsung SUR40'
May 12 17:56:14 livingplace-sur40 /usr/lib/gdm3/gdm-x-session[735]: (II) systemd-logind: got fd for /dev/input/event6 13:70 fd 57 paused 0
May 12 17:56:14 livingplace-sur40 /usr/lib/gdm3/gdm-x-session[735]: (**) Samsung SUR40: always reports core events
May 12 17:56:14 livingplace-sur40 /usr/lib/gdm3/gdm-x-session[735]: (**) Option "Device" "/dev/input/event6"
May 12 17:56:14 livingplace-sur40 /usr/lib/gdm3/gdm-x-session[735]: (**) Option "_source" "server/udev"
May 12 17:56:14 livingplace-sur40 /usr/lib/gdm3/gdm-x-session[735]: (II) event6  - Samsung SUR40: is tagged by udev as: Touchscreen
May 12 17:56:14 livingplace-sur40 /usr/lib/gdm3/gdm-x-session[735]: (II) event6  - Samsung SUR40: device is a touch device
May 12 17:56:14 livingplace-sur40 /usr/lib/gdm3/gdm-x-session[735]: (II) event6  - Samsung SUR40: device removed
May 12 17:56:14 livingplace-sur40 /usr/lib/gdm3/gdm-x-session[735]: (**) Option "config_info" "udev:/sys/devices/pci0000:00/0000:00:13.2/usb2/2-1/2-1:1.0/input/input14/event6"
May 12 17:56:14 livingplace-sur40 /usr/lib/gdm3/gdm-x-session[735]: (II) XINPUT: Adding extended input device "Samsung SUR40" (type: TOUCHSCREEN, id 12)
May 12 17:56:14 livingplace-sur40 /usr/lib/gdm3/gdm-x-session[735]: (**) Option "AccelerationScheme" "none"
May 12 17:56:14 livingplace-sur40 /usr/lib/gdm3/gdm-x-session[735]: (**) Samsung SUR40: (accel) selected scheme none/0
May 12 17:56:14 livingplace-sur40 /usr/lib/gdm3/gdm-x-session[735]: (**) Samsung SUR40: (accel) acceleration factor: 2.000
May 12 17:56:14 livingplace-sur40 /usr/lib/gdm3/gdm-x-session[735]: (**) Samsung SUR40: (accel) acceleration threshold: 4
May 12 17:56:14 livingplace-sur40 /usr/lib/gdm3/gdm-x-session[735]: (II) event6  - Samsung SUR40: is tagged by udev as: Touchscreen
May 12 17:56:14 livingplace-sur40 /usr/lib/gdm3/gdm-x-session[735]: (II) event6  - Samsung SUR40: device is a touch device

Might the SUR40 support does not work anymore for a newer kernel?

kikelkik commented 2 years ago

Finally, after compiling the sur40 kernel driver on my own (and therefore installing all needed dependencies - see modinfo) I got reacTIVision to consider the SUR40 with the hack: sudo ln -s /dev/v4l-touch0 /dev/video0

The reason why otherwise the device is not detected might be here: https://github.com/mkalten/reacTIVision/blob/master/ext/portvideo/linux/V4Linux2Camera.cpp#L262 I expected the SUR40 camera to be registered as "/dev/video0" in addition to /dev/v4l-touch0 but nevertheless I think it would be easier not to change the kernel module at this point but maybe make V4Linux2Camera.cpp handle it?

floe commented 2 years ago

@kikelkik thanks for the update - with which version of reacTIVision is it working now?

kikelkik commented 2 years ago

It works with both, the released 1.5.1 and latest master 1.6