Configure USB power for a webcam

#1

Hi,

I am trying to plug in a USB webcam to record photos or video.
I have installed fswebcam to take a test picture, but it is not working.
I believe the problem is that the USB port is not able to supply enough power for the webcam.

  1. Trying to take the picture, there is no recognized camera in /dev/video0:
pi@autopi-:~ $ fswebcam test_pic.jpg
--- Opening /dev/video0...
stat: No such file or directory
  1. When the camera is plugged:
pi@autopi:~ $ lsusb -v | egrep "^Bus|MaxPower"
Bus 001 Device 006: ID 046d:081b Webcam
    MaxPower              500mA
  1. Trying to find about the power of the USB ports (this one should be it since the id matches):
pi@autopi:~ $ usb-devices
T:  Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#=  6 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=046d ProdID=081b Rev=00.10
S:  SerialNumber=F5908A20
C:  #Ifs= 0 Cfg#= 0 Atr= MxPwr=

There doesn’t seem to be a fixed MxPwr value.

  1. In fact, after plugging the webcam:
pi@autopi:~ $ dmesg
[  120.973410] usb 1-1.1: new high-speed USB device number 6 using dwc_otg
[  121.314925] usb 1-1.1: New USB device found, idVendor=046d, idProduct=081b
[  121.314950] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=2
[  121.314963] usb 1-1.1: SerialNumber: F5908A20
[  121.315687] usb 1-1.1: rejected 1 configuration due to insufficient available bus power
[  121.315710] usb 1-1.1: no configuration chosen from 1 choice
[  121.315721] usb 1-1.1: No support over 100mA
[  121.315985] usb 1-1-port3: 500mA is over 100mA budget!
[  121.316004] hub 1-1:1.0: 150mA over power budget!

So my question is, how can I get around this?
Is there a way to increase this threshold?
Since the USB ports are not in the Pi Zero (but in the autopi board) maybe you could help.

Thanks in advance,
Iker

Raspberry Pi 3B+ with AutoPI 4G/LTE Power Issue[SOLVED]
#2

Hi Iker,

You can override the power safety by altering the udev rules:

echo 1 > /sys/bus/usb/devices/1-1.4/bConfigurationValue

Replace “1-1.4” with your USB device ID.

Please notice, you need some kind of script to persist this after a reboot.

best
Peter

#3

Hi @Peter,

Thanks a lot for the prompt reply.
I did cat /sys/bus/usb/devices/1-1.1/bConfigurationValue first.
I obtained a 1, and later it started working.
Not sure of what happened but now it works every time (even after reboot :man_shrugging:).

Thanks for the support.
Iker

#4

Hi iipr,

I’m also playing around to get a USB camera working. I actually got one myself.
You stated that you installated fswebcam on the autopi. Did you install it by simply running “sudo apt-get install fswebcam” ? If not, what syntax did you use?

Your help would be much appreciated…

Best regards,
Pravin

#5

Hi @Pravin,

Yes, that’s what I did. Here there is some more information.

Depending on what you want to do, it may be useful to try OpenCV directly from Python.

Best,
Iker