#1108416 zbarcam: Invalid argument in zbar_processor_init()

Package:
zbar-tools
Source:
zbar-tools
Description:
QR code / bar code scanner and decoder (utilities)
Submitter:
Kim Alvefur
Date:
2025-08-20 19:25:02 UTC
Severity:
normal
#1108416#5
Date:
2025-06-27 21:49:58 UTC
From:
To:
Dear Maintainer,

Running `zbarcam` produces the following output and exits with an error
code:

ERROR: zbar processor in zbar_processor_init():
    system error: spawning input thread: Invalid argument (22)

Output of `strace -o zbar.trace zbarcam` below.

#1108416#10
Date:
2025-06-27 22:18:23 UTC
From:
To:
Output of `zbarcam --verbose`:

_zbar_video_open: opened camera device /dev/video0 (fd=5)
_zbar_v4l2_probe: 5MP World Facing: 5MP World Fac on usb-0000:00:15.0-2 driver uvcvideo (version 6.12.29)
_zbar_v4l2_probe:     capabilities: CAPTURE READWRITE STREAMING
v4l2_reset_crop: crop bounds: 2560 x 1920 @ (0, 0)
v4l2_reset_crop: current crop win: 2560 x 1920 @ (0, 0) aspect 1 / 1
v4l2_probe_formats: Max supported size: 2560 x 1920
v4l2_probe_formats: current format: MJPG(47504a4d) 2560 x 1920 (line=0x0 size=0x960000)
v4l2_query_controls: Control class User:
v4l2_query_controls: int        Brightness                       - 0x980900
v4l2_query_controls: int        Contrast                         - 0x980901
v4l2_query_controls: int        Saturation                       - 0x980902
v4l2_query_controls: int        Hue                              - 0x980903
v4l2_query_controls: bool       White Balance, Automatic         - 0x98090c
v4l2_query_controls: int        Gamma                            - 0x980910
v4l2_query_controls: menu       Power Line Frequency             - 0x980918
v4l2_query_controls:            0: Disabled
v4l2_query_controls:            1: 50 Hz
v4l2_query_controls:            2: 60 Hz
v4l2_query_controls: int        White Balance Temperature        - 0x98091a
v4l2_query_controls: int        Sharpness                        - 0x98091b
v4l2_query_controls: int        Backlight Compensation           - 0x98091c
v4l2_query_controls: Control class Camera:
v4l2_query_controls: menu       Auto Exposure                    - 0x9a0901
v4l2_query_controls:            1: Manual Mode
v4l2_query_controls:            3: Aperture Priority Mode
v4l2_query_controls: int        Exposure Time, Absolute          - 0x9a0902
v4l2_query_controls: int        Focus, Absolute                  - 0x9a090a
v4l2_query_controls: bool       Focus, Automatic Continuous      - 0x9a090c
v4l2_get_supported_resolutions: 2560x1920 (30.00 fps)
v4l2_get_supported_resolutions: 1920x1080 (30.00 fps)
v4l2_get_supported_resolutions: 1600x1200 (30.00 fps)
v4l2_get_supported_resolutions: 1280x720 (30.00 fps)
v4l2_get_supported_resolutions: 640x480 (30.00 fps)
v4l2_get_supported_resolutions: 640x360 (30.00 fps)
WARNING: zbar video in v4l2_probe_iomode():
     system error: USERPTR failed. Falling back to mmap: Invalid argument (22)
_zbar_v4l2_probe: using I/O mode: MMAP
ERROR: zbar processor in _zbar_processor_open():
     X11 display error: unable to open X display
ERROR: zbar processor in zbar_processor_init():
     system error: spawning input thread: Invalid argument (22)
ERROR: zbar processor in zbar_processor_init():
     system error: spawning input thread: Invalid argument (22)

#1108416#15
Date:
2025-06-30 18:13:31 UTC
From:
To:
Hi Kim,

I tried to reproduce your bug but for me zbarcam works without problem.
Can you give some more information about the camera you used?

Also:

* Kim Alvefur <zash@zash.se> [2025-06-27 23:49]:

This does not include threads, can you you run it again with -ff?

* Kim Alvefur <zash@zash.se> [2025-06-28 00:18]:

I wonder if this due to the image size.

* Kim Alvefur <zash@zash.se> [2025-06-27 23:49]:

Given that zbar-tools is more then zbarcam and that it works for me,
would you be ok with downgrading this to important?

Cheers Jochen

#1108416#20
Date:
2025-07-03 12:56:35 UTC
From:
To:
Hi Jochen,

It's one of the built-in cameras on a TravelMate Spin B311R-31

$ sudo lshw
(snip)
	*-usb:0
			 description: Video
			 product: 5MP World Facing
			 vendor: Chicony Electronics Co.,Ltd.
			 physical id: 2
			 bus info: usb@1:2
			 version: 62.27
			 serial: 0001
			 capabilities: usb-2.01
			 configuration: driver=uvcvideo maxpower=500mA speed=480Mbit/s
	*-usb:1
			 description: Video
			 product: HD User Facing
			 vendor: SunplusIT Inc
			 physical id: 7
			 bus info: usb@1:7
			 version: 0.04
			 capabilities: usb-2.01
			 configuration: driver=uvcvideo maxpower=500mA speed=480Mbit/s
(snip)

Anything other information that may be relevant?

See attached.

Sure.

I imagine this could also be something in the kernel rather than in zbar-tools
but I haven't looked into that yet.

#1108416#25
Date:
2025-07-03 13:18:28 UTC
From:
To:
* Kim Alvefur <zash@zash.se> [2025-07-03 14:56]:

Interesting, can you try with the other camera? Probably

zbarcam /dev/video1

you can try:

mpv av://v4l2:/dev/video0

to test.

Cheers Jochen

#1108416#32
Date:
2025-07-03 15:30:12 UTC
From:
To:
== /dev/video0 ==
ERROR: zbar processor in zbar_processor_init():
     system error: spawning input thread: Invalid argument (22)
== /dev/video1 ==
WARNING: zbar processor in _zbar_v4l2_probe():
     unsupported request: v4l2 device does not support usable CAPTURE
== /dev/video2 ==
ERROR: zbar processor in zbar_processor_init():
     system error: spawning input thread: Invalid argument (22)
== /dev/video3 ==
WARNING: zbar processor in _zbar_v4l2_probe():
     unsupported request: v4l2 device does not support usable CAPTURE

(quit after a few seconds)

$ mpv av://v4l2:/dev/video0
client removed during hook handling
● Video  --vid=1  (rawvideo 1600x1200 5 fps)
[autoconvert] Converting yuyv422 -> yuv422p
VO: [gpu] 1600x1200 yuv422p
[ffmpeg/demuxer] video4linux2,v4l2: Some buffers are still owned by the
caller on close.
V: 00:00:03 / 00:00:04 (85%)
Exiting... (Quit)
ioctl(VIDIOC_QBUF): Bad file descriptor
~$ mpv av://v4l2:/dev/video2
● Video  --vid=1  (rawvideo 1280x720 10 fps)
[autoconvert] Converting yuyv422 -> yuv422p
VO: [gpu] 1280x720 yuv422p
[ffmpeg/demuxer] video4linux2,v4l2: Some buffers are still owned by the
caller on close.
V: 00:00:04 / 00:00:04 (84%)
Exiting... (Quit)
ioctl(VIDIOC_QBUF): Bad file descriptor
ioctl(VIDIOC_QBUF): Bad file descriptor
ioctl(VIDIOC_QBUF): Bad file descriptor
ioctl(VIDIOC_QBUF): Bad file descriptor
ioctl(VIDIOC_QBUF): Bad file descriptor
ioctl(VIDIOC_QBUF): Bad file descriptor
ioctl(VIDIOC_QBUF): Bad file descriptor
ioctl(VIDIOC_QBUF): Bad file descriptor

The odd-numbered devices...

$ mpv av://v4l2:/dev/video1
client removed during hook handling
[ffmpeg/demuxer] video4linux2,v4l2: ioctl(VIDIOC_G_INPUT): Inappropriate ioctl for device
[lavf] avformat_open_input() failed
Failed to recognize file format.
Exiting... (Errors when loading file)
~$ mpv av://v4l2:/dev/video3
[ffmpeg/demuxer] video4linux2,v4l2: ioctl(VIDIOC_G_INPUT): Inappropriate ioctl for device
[lavf] avformat_open_input() failed
Failed to recognize file format.
Exiting... (Errors when loading file)

#1108416#37
Date:
2025-07-04 08:03:42 UTC
From:
To:
* Kim Alvefur <zash@zash.se> [2025-07-03 17:30]:

Given that, did you find any other program that worked with the video
devices? Maybe it is a bug in the kernel driver after all.

Cheers Jochen

#1108416#42
Date:
2025-07-08 11:04:02 UTC
From:
To:
Cheese seems to work just fine, as does Firefox.
I will try downgrading the kernel.

#1108416#47
Date:
2025-08-20 19:13:13 UTC
From:
To:
Hello,

zbarcam seems to work again with kernel `uname -r` -> 6.12.38+deb13-amd64

I have unfortunately forgotten if I did any tests with older kernels.