Cheap actioncams Allwinner / Renkforce / Pruveeo / Andoer as a usb webcam under Linux
by tarnow from LinuxQuestions.org on (#52AV4)
Due to current situation with COVID-19 many people have to work from home and participate in video conferences. If you happen to need a new PC camera now like me you will find out that the prices of new PC cameras that used to cost $50 went up drastically. So I thought about using for this purpose one of the "still" cheap actioncams which could also run in PC camera mode.
Here is a cheap and silly workaround for 4K action cameras with idVendor=1f3a (USB ID 1f3a:10** Onda (unverified) Android) to avoid automatic USB disconnect and switch to storage when in camera mode. I have tested it on Slackware but it should work on any Linux distro
# as root modify kernel and module options (this was taken from other user suggestions which helps to keep the camera up a little bit longer)
vi /etc/udev/rules.d/51-android.rules
KERNELS=="[1-9]*-[0-9]*", SUBSYSTEMS=="usb", DRIVERS=="usb", ATTRS{idVendor}!="1f3a", ENV{IF_STORAGE_REMOVE_ME}="1"
ENV{IF_STORAGE_REMOVE_ME}=="1", DRIVERS=="usb-storage", DRIVER=="sd", RUN+="/bin/sh -c 'echo -n %k >/sys%p/driver/unbind'"
SUBSYSTEM=="video4linux", ATTRS{idVendor}=="1f3a", NAME:="video0"
SUBSYSTEM=="video4linux", ATTRS{idVendor}=="1f3a", NAME:="video1"
vi /etc/modprobe.d/uvcvideo.conf
options uvcvideo quirks=0x80
# reboot
# when PC is up turn your camera on but do not activate camera mode yet
# Run as user cat command on video devices in an infinite loop to make the camera believe that the video device is constantly accessed which avoids disconnects
while :; do cat /dev/video*; sleep 1; done
# activate the camera mode now
# In another terminal window as user verify the video output
mplayer tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0 -fps 60
# as long as the "while do" loop is running the Camera should stay in the camera mode and the video device /dev/video* should be available at this time to other applications like Microsoft Teams or Skype


Here is a cheap and silly workaround for 4K action cameras with idVendor=1f3a (USB ID 1f3a:10** Onda (unverified) Android) to avoid automatic USB disconnect and switch to storage when in camera mode. I have tested it on Slackware but it should work on any Linux distro
# as root modify kernel and module options (this was taken from other user suggestions which helps to keep the camera up a little bit longer)
vi /etc/udev/rules.d/51-android.rules
KERNELS=="[1-9]*-[0-9]*", SUBSYSTEMS=="usb", DRIVERS=="usb", ATTRS{idVendor}!="1f3a", ENV{IF_STORAGE_REMOVE_ME}="1"
ENV{IF_STORAGE_REMOVE_ME}=="1", DRIVERS=="usb-storage", DRIVER=="sd", RUN+="/bin/sh -c 'echo -n %k >/sys%p/driver/unbind'"
SUBSYSTEM=="video4linux", ATTRS{idVendor}=="1f3a", NAME:="video0"
SUBSYSTEM=="video4linux", ATTRS{idVendor}=="1f3a", NAME:="video1"
vi /etc/modprobe.d/uvcvideo.conf
options uvcvideo quirks=0x80
# reboot
# when PC is up turn your camera on but do not activate camera mode yet
# Run as user cat command on video devices in an infinite loop to make the camera believe that the video device is constantly accessed which avoids disconnects
while :; do cat /dev/video*; sleep 1; done
# activate the camera mode now
# In another terminal window as user verify the video output
mplayer tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0 -fps 60
# as long as the "while do" loop is running the Camera should stay in the camera mode and the video device /dev/video* should be available at this time to other applications like Microsoft Teams or Skype