It looks like FarmBot folks are giving you great support help, but I thought I’d add a few things I’ve seen. I have the Genesis XL 1.5 camera. Before using it on the FarmBot Raspberry Pi, I tried it on my x86 Debian Buster (10) workstation. I wasn’t able to get it to work at first, but eventually did get it going.
-
On the “regular” USB ports on my workstation, I was able to see the camera in dmesg
and lsusb
, but wasn’t able to use it. When I plugged it into the blue USB ports, I was able to use it.
-
On my workstation I added this module option, but I’m not sure if that is what fixed it or not. This file: /etc/modprobe.d/uvcvideo.conf
with this line: options uvcvideo quirks=0x100
-
In general, when unplugging/plugging in USB to cycle it, wait 5 seconds at least to make sure the USB system “settles down”. Plugging it out and in quickly sometimes it won’t be detected.
-
To test the camera on my workstation, I ran this command:
mplayer \
-vo xv \
-tv device=/dev/video2:driver=v4l2:width=640:height=480 \
tv://
Note, my workstation has another camera, so you probably have to change /dev/video2
to /dev/video0
or /dev/video1
if you test on a workstation without another camera.
I then connected up the camera to my FarmBot here on my desk. I have a serial cable connected so I can do debugging of the raspberry Pi. Here is excerpts of what I get when I do a fresh power on of the system, then do “Take Photo” in Farmware in the web, then power off:
[ 0.000000] Booting Linux on physical CPU 0x0
...
[ 8.006596] media: Linux media interface: v0.10
[ 8.037998] videodev: Linux video capture interface: v2.00
[ 8.075670] uvcvideo: Unable to create debugfs directory
[ 8.083787] uvcvideo: Found UVC 1.00 device USB2.0 PC CAMERA (1908:2311)
[ 8.092884] uvcvideo: Failed to query (GET_INFO) UVC control 2 on unit 2: -71 (exp. 1).
[ 8.106254] uvcvideo: Failed to query (GET_INFO) UVC control 8 on unit 2: -71 (exp. 1).
[ 8.119055] uvcvideo: Failed to query (GET_INFO) UVC control 1 on unit 2: -71 (exp. 1).
[ 8.131944] uvcvideo: Failed to query (GET_INFO) UVC control 5 on unit 2: -71 (exp. 1).
[ 8.145661] uvcvideo 1-1.4:1.0: Entity type for entity Processing 2 was not initialized!
[ 8.158690] uvcvideo 1-1.4:1.0: Entity type for entity Camera 1 was not initialized!
[ 8.171853] input: USB2.0 PC CAMERA: USB2.0 PC CAM as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0/input/input0
[ 8.189137] usbcore: registered new interface driver uvcvideo
[ 8.197787] USB Video Class driver (1.1.1)
[ 8.707131] vc_sm_cma: module is from the staging directory, the quality is unknown, you have been warned.
[ 8.724018] bcm2835_vc_sm_cma_probe: Videocore shared memory driver
[ 8.733166] [vc_sm_connected_init]: start
[ 8.740385] [vc_sm_connected_init]: installed successfully
[ 8.813488] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[ 8.831546] bcm2835_v4l2: module is from the staging directory, the quality is unknown, you have been warned.
[ 9.936056] snd_bcm2835: module is from the staging directory, the quality is unknown, you have been warned.
[ 9.956384] bcm2835_audio soc:audio: card created with 8 channels
[ 10.699155] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[ 10.732638] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[ 10.781744] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[ 10.981148] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[ 11.003576] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43430/1 wl0: May 2 2019 02:39:18 version 7.45.98.83 (r714225 CY) FWID 01-e539531f
[ 11.171256] rpi-ft5406 rpi_ft5406: Probing device
[ 11.177986] input: FT5406 memory based driver as /devices/virtual/input/input1
LED STATUS: yellow off
LED STATUS: red slow_blink
LED STATUS: yellow slow_blink
LED STATUS: red slow_blink
LED STATUS: yellow slow_blink
LED STATUS: yellow off
LED STATUS: red solid
Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 923
Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 923
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround40
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround41
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround50
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround51
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958
Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 923
ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'defaults.pcm.dmix.channels'
ALSA lib conf.c:4660:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5137:(snd_config_expand) Args evaluate error: No such file or directory
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM dmix
[ 29.274218] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
[ 30.750031] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1
LED STATUS: blue off
LED STATUS: green really_fast_blink
LED STATUS: blue solid
LED STATUS: green solid
warning: deprecated time unit: :microseconds. A time unit should be :second, :millisecond, :microsecond, :nanosecond, or a positive integer
...
LED STATUS: blue solid
LED STATUS: green really_fast_blink
LED STATUS: green solid
LED STATUS: green really_fast_blink
LED STATUS: green solid
/usr/lib/python3.8/site-packages/numpy/ma/core.py:4466: SyntaxWarning: "is" with a literal. Did you mean "=="?
if self.shape is ():
[ WARN:0] VIDEOIO(cvCreateCameraCapture_V4L(index)): trying ...
[ 118.877079] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: -71 (exp. 2).
[ 118.887755] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: -71 (exp. 2).
[ 118.898397] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: -71 (exp. 2).
[ 118.912965] uvcvideo: Failed to query (GET_CUR) UVC control 3 on unit 2: -71 (exp. 2).
[ 118.927159] uvcvideo: Failed to query (GET_DEF) UVC control 7 on unit 2: -71 (exp. 2).
[ 118.942705] uvcvideo: Failed to query (GET_DEF) UVC control 8 on unit 2: -71 (exp. 2).
[ 118.956326] uvcvideo: Failed to query (GET_DEF) UVC control 1 on unit 2: -71 (exp. 2).
[ WARN:0] VIDEOIO(cvCreateCameraCapture_V4L(index)): result=0x1c62f08 ...
[ 119.110834] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: -71 (exp. 2).
[ 119.124686] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: -71 (exp. 2).
[ 119.135674] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: -71 (exp. 2).
[ 119.146879] uvcvideo: Failed to query (GET_CUR) UVC control 3 on unit 2: -71 (exp. 2).
[ 119.157921] uvcvideo: Failed to query (GET_DEF) UVC control 7 on unit 2: -71 (exp. 2).
[ 119.169127] uvcvideo: Failed to query (GET_DEF) UVC control 8 on unit 2: -71 (exp. 2).
[ 119.180138] uvcvideo: Failed to query (GET_DEF) UVC control 1 on unit 2: -71 (exp. 2).
libv4l2: error turning on stream: Protocol error
VIDIOC_STREAMON: Protocol error
[ 0.1674] Importing farmware_tools...
[ 0.1676] Import complete.
[ 0.1677] Importing opencv...
[ 0.5205] Import complete.
[ 0.5208] Found /dev/video0
[ 0.5279] Unable to check if busy.
[ 0.5282] Opening camera...
[ 0.756] using backend: V4L2
[ 0.8566] Camera opened successfully.
[ 0.8568] Adjusting image with test captures...
[ 0.9657] No image.
LED STATUS: yellow slow_blink
[ 179.772922] erlinit: Timed out while waiting for Erlang VM to exit.
[ 179.780732] erlinit: Sending SIGTERM to all processes
[nbtty: t[ 179.787699] watchdog: watchdog0: watchdog did not stop!
erminating via signal]
[ 180.810867] erlinit: Sending SIGKILL to all processes
[ 181.428342] reboot: Power down
Simultaneously, I ssh into the FarmBot Raspberry Pi and enable logs:
$ ssh farmpi
Interactive Elixir (1.9.0) - press Ctrl+C to exit (type h() ENTER for help)
iex(farmbot@farmbot-0000000016df09e9.local)1> RingLogger.attach()
:ok
18:02:34.906 [info] Installed Farmware: historical-plant-detection
18:02:34.941 [info] Installed Farmware: take-photo
18:02:34.975 [info] Installed Farmware: historical-camera-calibration
18:02:35.000 [info] Installed Farmware: camera-calibration
18:02:35.028 [info] Installed Farmware: plant-detection
iex(farmbot@farmbot-0000000016df09e9.local)2>
nil
18:03:23.897 [info] Executing Farmware: take-photo
18:03:24.044 [debug] opening pipe: /tmp/farmware_runtime/take-photo-908212f3-farmware-request-pipe
18:03:24.063 [debug] opening pipe: /tmp/farmware_runtime/take-photo-908212f3-farmware-response-pipe
18:03:24.084 [debug] spawning farmware: /usr/bin/python Take-Photo-master/take_photo.py
18:03:24.164 [debug] in requesting: 10 bytes
18:03:33.115 [error] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: -71 (exp. 2).
18:03:33.116 [error] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: -71 (exp. 2).
18:03:33.129 [error] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: -71 (exp. 2).
18:03:33.144 [error] uvcvideo: Failed to query (GET_CUR) UVC control 3 on unit 2: -71 (exp. 2).
18:03:33.159 [error] uvcvideo: Failed to query (GET_DEF) UVC control 7 on unit 2: -71 (exp. 2).
18:03:33.173 [error] uvcvideo: Failed to query (GET_DEF) UVC control 8 on unit 2: -71 (exp. 2).
18:03:33.187 [error] uvcvideo: Failed to query (GET_DEF) UVC control 1 on unit 2: -71 (exp. 2).
18:03:33.353 [error] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: -71 (exp. 2).
18:03:33.353 [error] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: -71 (exp. 2).
18:03:33.363 [error] uvcvideo: Failed to query (GET_DEF) UVC control 2 on unit 2: -71 (exp. 2).
18:03:33.375 [error] uvcvideo: Failed to query (GET_CUR) UVC control 3 on unit 2: -71 (exp. 2).
18:03:33.386 [error] uvcvideo: Failed to query (GET_DEF) UVC control 7 on unit 2: -71 (exp. 2).
18:03:33.397 [error] uvcvideo: Failed to query (GET_DEF) UVC control 8 on unit 2: -71 (exp. 2).
18:03:33.408 [error] uvcvideo: Failed to query (GET_DEF) UVC control 1 on unit 2: -71 (exp. 2).
18:03:33.436 [debug] in buffering 213 bytes
18:03:33.537 [debug] in pipe worker read 10 bytes successfully 203 bytes remaining in buffer.
18:03:33.638 [debug] in requesting: 203 bytes
18:03:33.739 [debug] in pipe worker read 203 bytes successfully 0 bytes remaining in buffer.
18:03:33.741 [debug] executing rpc from farmware: %FarmbotCeleryScript.AST{args: %{label: "fa55514b-b050-4b19-9c9a-d3b45bf5bff9"}, body: [%FarmbotCeleryScript.AST{args: %{message: "[take-photo] Problem getting image.", message_type: "error"}, body: [], comment: nil, kind: :send_message, meta: nil}], comment: nil, kind: :rpc_request, meta: nil}
18:03:33.897 [info] [take-photo] Problem getting image.
18:03:33.897 [debug] out writing 120 bytes
18:03:33.941 [debug] in requesting: 10 bytes
18:03:34.200 [debug] Farmware exit
18:03:34.200 [info] CeleryScript ok [#Reference<0.2921139114.805830658.51941>]:
18:04:23.560 [info] Emergency locking and powering down
18:04:23.575 [info] Emergency lock
18:04:23.604 [info] power down event: "Shut down requested by Sequence or frontend"
18:04:23.649 [info] Elixir.Nerves.Runtime : device told to poweroff
...
It fails to take a photo. In the web browser Farmware tab/logs it says “[take-photo] Problem getting image.
”
I can send you the full dumps if you want them.
Thanks for any suggestions. 