Awesome007
Posts: 2
Joined: Mon May 20, 2019 8:38 pm

USB Hub working on RPI3 but not on RPI-zero-w

Mon May 20, 2019 9:40 pm

hello
i have a raspberry pi zero W (host name 15Mat-below) running motion, conected via a usb hub (unpowered) with 2 webcams connected, BUT only 1 camera works at a time, the other camera is not accessible via motion.
With same setup my raspberry pi 3 (host name 40P-below) works perfectly fine keeping all same i.e. same power supply, and also via same USB hub connecting the same 2 x cameras - no problem.

i need a scale down / cost effective solution, and therefore I am very interested to find out why the pi zero is not able to open both cameras simultaneously via passive usb hub, like the pi 3 does in same setup? Please Help.

below are some output files and let me know if more is needed.

------------------------------------
Version Pi 3

Code: Select all

pi@40P:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

Code: Select all

pi@40P:~ $ uname -a
Linux 40P 4.14.98-v7+ #1200 SMP Tue Feb 12 20:27:48 GMT 2019 armv7l GNU/Linux

-------------------------------------

Version Zero W

Code: Select all

pi@15Mat:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

Code: Select all

pi@15Mat:~ $ uname -a
Linux 15Mat 4.19.42+ #1219 Tue May 14 21:16:38 BST 2019 armv6l GNU/Linux
lsusb output indicating both cameras are "picked up"

Code: Select all

pi@15Mat:~ $ lsusb
Bus 001 Device 004: ID 1871:0101 Aveo Technology Corp. UVC camera (Bresser microscope)
Bus 001 Device 003: ID 1871:0101 Aveo Technology Corp. UVC camera (Bresser microscope)
Bus 001 Device 002: ID 1a40:0101 Terminus Technology Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
var log motion log output RPI 0W.
in this case it can be seem "/dev/video1" is not functioning thus i get unable to open video device error, on port 8082. (port 8081 - /dev/video0 is fine)

Code: Select all

[0:motion] [NTC] [ALL] [May 20 22:57:58] motion_startup: Using log type (ALL) log level (NTC)
[0:motion] [NTC] [ALL] [May 20 22:57:58] become_daemon: Motion going to daemon mode
[0:motion] [NTC] [ALL] [May 20 22:57:58] become_daemon: Created process id file /var/run/motion/motion.pid. Process ID is 1060
[0:motion] [NTC] [ALL] [May 20 22:57:58] motion_startup: Motion running as daemon process
[0:motion] [NTC] [ENC] [May 20 22:57:58] ffmpeg_init: ffmpeg libavcodec version 57.48.101 libavformat version 57.41.100
[0:motion] [NTC] [ALL] [May 20 22:57:58] main: Camera 1 is from /etc/motion/camera1-dist.conf
[0:motion] [NTC] [ALL] [May 20 22:57:58] main: Camera 1 is device: /dev/video0 input -1
[0:motion] [NTC] [ALL] [May 20 22:57:58] main: Stream port 8081
[0:motion] [NTC] [ALL] [May 20 22:57:58] main: Camera 2 is from /etc/motion/camera2-dist.conf
[0:motion] [NTC] [ALL] [May 20 22:57:58] main: Camera 2 is device: /dev/video1 input -1
[0:motion] [NTC] [ALL] [May 20 22:57:58] main: Stream port 8082
[0:motion] [NTC] [ALL] [May 20 22:57:58] main: Waiting for threads to finish, pid: 1060
[0:web_control] [NTC] [STR] [May 20 22:57:58] http_bindsock: listening on 127.0.0.1 port 8080
[0:web_control] [NTC] [STR] [May 20 22:57:58] httpd_run: Started motion-httpd server on port 8080 (auth Disabled)
[2:ml2] [NTC] [ALL] [May 20 22:57:58] motion_init: Camera 2 started: motion detection Enabled
[2:ml2] [NTC] [VID] [May 20 22:57:58] vid_v4lx_start: Using videodevice /dev/video1 and input -1
[2:ml2] [NTC] [VID] [May 20 22:57:58] v4l2_get_capability:
------------------------
cap.driver: "uvcvideo"
cap.card: "USB2.0 Camera: USB2.0 Camera"
cap.bus_info: "usb-20980000.usb-1.1"
cap.capabilities=0x84A00001
------------------------
[2:ml2] [NTC] [VID] [May 20 22:57:58] v4l2_get_capability: - VIDEO_CAPTURE
[2:ml2] [NTC] [VID] [May 20 22:57:58] v4l2_get_capability: - STREAMING
[2:ml2] [ERR] [VID] [May 20 22:57:58] v4l2_select_input: Unable to query input 0. VIDIOC_ENUMINPUT, if you use a WEBCAM change input value in conf by -1: Inappropriate$
[2:ml2] [NTC] [VID] [May 20 22:57:58] vid_v4lx_start: Using V4L1
[2:ml2] [NTC] [ALL] [May 20 22:57:58] image_ring_resize: Resizing pre_capture buffer to 1 items
[1:ml1] [NTC] [ALL] [May 20 22:57:58] motion_init: Camera 1 started: motion detection Enabled
[1:ml1] [NTC] [VID] [May 20 22:57:58] vid_v4lx_start: Using videodevice /dev/video0 and input -1
[1:ml1] [NTC] [VID] [May 20 22:57:58] v4l2_get_capability:
------------------------
cap.driver: "uvcvideo"
cap.card: "USB2.0 Camera: USB2.0 Camera"
cap.bus_info: "usb-20980000.usb-1.1"
cap.capabilities=0x84A00001
------------------------
[1:ml1] [NTC] [VID] [May 20 22:57:58] v4l2_get_capability: - VIDEO_CAPTURE
[1:ml1] [NTC] [VID] [May 20 22:57:58] v4l2_get_capability: - STREAMING
[1:ml1] [NTC] [VID] [May 20 22:57:58] v4l2_select_input: name = "Camera 1", type 0x00000002, status 00000000
[1:ml1] [NTC] [VID] [May 20 22:57:58] v4l2_select_input: - CAMERA
[1:ml1] [WRN] [VID] [May 20 22:57:58] v4l2_select_input: Device doesn't support VIDIOC_G_STD
[1:ml1] [NTC] [VID] [May 20 22:57:58] v4l2_set_pix_format: Config palette index 17 (YU12) doesn't work.
[1:ml1] [NTC] [VID] [May 20 22:57:58] v4l2_set_pix_format: Supported palettes:
[1:ml1] [NTC] [VID] [May 20 22:57:58] v4l2_set_pix_format: (0) YUYV (YUYV 4:2:2)
[1:ml1] [NTC] [VID] [May 20 22:57:58] v4l2_set_pix_format: 0 - YUYV 4:2:2 (compressed : 0) (0x56595559)
[1:ml1] [NTC] [VID] [May 20 22:57:58] v4l2_set_pix_format Selected palette YUYV
[1:ml1] [NTC] [VID] [May 20 22:57:58] v4l2_do_set_pix_format: Testing palette YUYV (320x240)
[1:ml1] [NTC] [VID] [May 20 22:57:58] v4l2_do_set_pix_format: Using palette YUYV (320x240) bytesperlines 640 sizeimage 153600 colorspace 00000008
[1:ml1] [NTC] [VID] [May 20 22:57:58] v4l2_scan_controls: found control 0x00980900, "Brightness", range 0,100
[1:ml1] [NTC] [VID] [May 20 22:57:58] v4l2_scan_controls:       "Brightness", default -8193, current 30
[1:ml1] [NTC] [VID] [May 20 22:57:58] v4l2_scan_controls: found control 0x00980901, "Contrast", range 0,100
[1:ml1] [NTC] [VID] [May 20 22:57:58] v4l2_scan_controls:       "Contrast", default 57343, current 57
[1:ml1] [NTC] [VID] [May 20 22:57:58] v4l2_scan_controls: found control 0x00980902, "Saturation", range 0,4
[1:ml1] [NTC] [VID] [May 20 22:57:58] v4l2_scan_controls:       "Saturation", default 57343, current 2
[1:ml1] [NTC] [VID] [May 20 22:57:58] v4l2_scan_controls: found control 0x00980918, "Power Line Frequency", range 0,2
[1:ml1] [NTC] [VID] [May 20 22:57:58] v4l2_scan_controls:       "Power Line Frequency", default 2, current 2
[1:ml1] [NTC] [VID] [May 20 22:57:58] v4l2_scan_controls: found control 0x00980910, "Gamma", range 1,8
[1:ml1] [NTC] [VID] [May 20 22:57:58] v4l2_scan_controls:       "Gamma", default 57343, current 3
[1:ml1] [NTC] [VID] [May 20 22:57:58] vid_v4lx_start: Using V4L2
[1:ml1] [NTC] [ALL] [May 20 22:57:58] image_ring_resize: Resizing pre_capture buffer to 1 items
[1:ml1] [NTC] [STR] [May 20 22:57:59] http_bindsock: listening on any IPv4 address port 8081
[1:ml1] [NTC] [ALL] [May 20 22:57:59] motion_init: Started motion-stream server on port 8081 (auth Disabled)
[2:ml2] [ERR] [ALL] [May 20 22:58:08] motion_init: Error capturing first image
[2:ml2] [NTC] [STR] [May 20 22:58:08] http_bindsock: listening on any IPv4 address port 8082
[2:ml2] [NTC] [ALL] [May 20 22:58:08] motion_init: Started motion-stream server on port 8082 (auth Disabled)
[2:ml2] [ERR] [ALL] [May 20 22:58:08] motion_loop: Video device fatal error - Closing video device
[2:ml2] [NTC] [VID] [May 20 22:58:08] vid_close: Closing video device /dev/video1
[2:ml2] [WRN] [ALL] [May 20 22:58:10] motion_loop: Retrying until successful connection with camera
[2:ml2] [NTC] [VID] [May 20 22:58:10] vid_v4lx_start: Using videodevice /dev/video1 and input -1
[2:ml2] [NTC] [VID] [May 20 22:58:10] v4l2_get_capability:
------------------------
cap.driver: "uvcvideo"
cap.card: "USB2.0 Camera: USB2.0 Camera"
cap.bus_info: "usb-20980000.usb-1.1"
cap.capabilities=0x84A00001
------------------------
[2:ml2] [NTC] [VID] [May 20 22:58:10] v4l2_get_capability: - VIDEO_CAPTURE
[2:ml2] [NTC] [VID] [May 20 22:58:10] v4l2_get_capability: - STREAMING
[2:ml2] [ERR] [VID] [May 20 22:58:10] v4l2_select_input: Unable to query input 0. VIDIOC_ENUMINPUT, if you use a WEBCAM change input value in conf by -1: Inappropriate$
[2:ml2] [NTC] [VID] [May 20 22:58:10] vid_v4lx_start: Using V4L1
[2:ml2] [ERR] [ALL] [May 20 22:58:10] motion_loop: Video device fatal error - Closing video device
[2:ml2] [NTC] [VID] [May 20 22:58:10] vid_close: Closing video device /dev/video1
[2:ml2] [WRN] [ALL] [May 20 22:58:20] motion_loop: Retrying until successful connection with camera
[2:ml2] [NTC] [VID] [May 20 22:58:20] vid_v4lx_start: Using videodevice /dev/video1 and input -1
[2:ml2] [NTC] [VID] [May 20 22:58:20] v4l2_get_capability:
------------------------
cap.driver: "uvcvideo"
cap.card: "USB2.0 Camera: USB2.0 Camera"
cap.bus_info: "usb-20980000.usb-1.1"
cap.capabilities=0x84A00001
------------------------
[2:ml2] [NTC] [VID] [May 20 22:58:20] v4l2_get_capability: - VIDEO_CAPTURE
[2:ml2] [NTC] [VID] [May 20 22:58:20] v4l2_get_capability: - STREAMING
[2:ml2] [ERR] [VID] [May 20 22:58:20] v4l2_select_input: Unable to query input 0. VIDIOC_ENUMINPUT, if you use a WEBCAM change input value in conf by -1: Inappropriate$
[2:ml2] [NTC] [VID] [May 20 22:58:20] vid_v4lx_start: Using V4L1
[2:ml2] [ERR] [ALL] [May 20 22:58:20] motion_loop: Video device fatal error - Closing video device
[2:ml2] [NTC] [VID] [May 20 22:58:20] vid_close: Closing video device /dev/video1
[2:ml2] [WRN] [ALL] [May 20 22:58:30] motion_loop: Retrying until successful connection with camera
[2:ml2] [NTC] [VID] [May 20 22:58:30] vid_v4lx_start: Using videodevice /dev/video1 and input -1
[2:ml2] [NTC] [VID] [May 20 22:58:30] v4l2_get_capability:
------------------------
cap.driver: "uvcvideo"
cap.card: "USB2.0 Camera: USB2.0 Camera"
cap.bus_info: "usb-20980000.usb-1.1"
cap.capabilities=0x84A00001
------------------------
[2:ml2] [NTC] [VID] [May 20 22:58:30] v4l2_get_capability: - VIDEO_CAPTURE
[2:ml2] [NTC] [VID] [May 20 22:58:30] v4l2_get_capability: - STREAMING
[2:ml2] [ERR] [VID] [May 20 22:58:30] v4l2_select_input: Unable to query input 0. VIDIOC_ENUMINPUT, if you use a WEBCAM change input value in conf by -1: Inappropriate$
[2:ml2] [NTC] [VID] [May 20 22:58:30] vid_v4lx_start: Using V4L1
[2:ml2] [ERR] [ALL] [May 20 22:58:30] motion_loop: Video device fatal error - Closing video device
[2:ml2] [NTC] [VID] [May 20 22:58:30] vid_close: Closing video device /dev/video1
[2:ml2] [WRN] [ALL] [May 20 22:58:40] motion_loop: Retrying until successful connection with camera
[2:ml2] [NTC] [VID] [May 20 22:58:40] vid_v4lx_start: Using videodevice /dev/video1 and input -1
[2:ml2] [NTC] [VID] [May 20 22:58:40] v4l2_get_capability:
------------------------
cap.driver: "uvcvideo"
.
.

and /dev/video1 is linked to port 8082 as per /etc/motion/camera2-dist.conf. (RPI-0W))

Code: Select all

# /etc/motion/camera2.conf
#
# This config file was generated by motion 4.0

###########################################################
# Capture device options
############################################################

# Camera Id
# Consistent identification number to assign to each camera across multiple
# invocations of Motion.
# Default: The order when the camera file was read
# camera_id = 2

# Videodevice to be used for capturing  (default /dev/video0)
# for FreeBSD default is /dev/bktr0
videodevice /dev/video1

# The video input to be used (default: -1)
# Should normally be set to 1 for video/TV cards, and -1 for USB cameras
input -1

# Draw a user defined text on the images using same options as C function strftime(3)
# Default: Not defined = no text
# Text is placed in lower left corner
text_left CAMERA 2


############################################################
# Target Directories and filenames For Images And Films
# For the options snapshot_, picture_, mpeg_ and timelapse_filename
# you can use conversion specifiers
# %Y = year, %m = month, %d = date,
# %H = hour, %M = minute, %S = second,
# %v = event, %q = frame number, %t = camera id number,
# %D = changed pixels, %N = noise level,
# %i and %J = width and height of motion area,
# %K and %L = X and Y coordinates of motion center
# %C = value defined by text_event
# Quotation marks round string are allowed.
############################################################

# Target base directory for pictures and films
# Recommended to use absolute patch. (Default: current working directory)
#target_dir /tmp/motion/cam2

# File path for motion triggered images (jpeg or ppm) relative to target_dir
# Default: %v-%Y%m%d%H%M%S-%q
# Default value is equivalent to legacy oldlayout option
# For Motion 3.0 compatible mode choose: %Y/%m/%d/%H/%M/%S-%q
# File extension .jpg or .ppm is automatically added so do not include this
# Set to 'preview' together with best-preview feature enables special naming
# convention for preview shots. See motion guide for details
picture_filename CAM2_%v-%Y%m%d%H%M%S-%q


############################################################
# Live Stream Server
############################################################

# The mini-http server listens to this port for requests (default: 0 = disabled)
stream_port 8082

# Command to be executed when a picture (.ppm|.jpg) is saved (default: none)
# The filename of the picture is appended as an argument for the command.
#on_picture_save /usr/local/motion-extras/camparse2.pl

# Command to be executed when a movie file (.mpg|.avi) is closed. (default: none)
# Filename of movie is appended as an argument for the command.
#on_movie_end /usr/local/motion-extras/mpegparse2.pl
Lastly in motion.conf file, i have reduced the frame-rate to 2, and height and width to 240 each, and quality of video to 30%. images and videos are disabled.

Return to “Troubleshooting”