1 (edited by elliotwoods 2009-08-08 12:11:58)

Topic: webcam

hi all

some people seem to have had some success with webcams though i'm not getting very far at the moment

i'm currently trying to get a Trust WB-5400 webcam to work

under osx (my build environment), when i run "system_profiler SPUSBDataType"
i get:

        USB20 Camera:

          Product ID: 0x624e
          Vendor ID: 0x0c45  (Sonix Technology Co., Ltd.)
          Version: 1.00
          Speed: Up to 480 Mb/sec
          Location ID: 0x24100000
          Current Available (mA): 500
          Current Required (mA): 500

when i plug it into chumby, i get a new entry "/dev/usbdev1.3" or "/dev/usbdev1.4" or "/dev/usbdev1.5"
lsusb doesn't seem to exist on the chumby so cant get more info. can it be built?
i'm still having trouble trying to build hello world for chumby at the moment!
(cant find include files, e.g. iosteam using arm-elf-gcc)

This page and this one suggest that it uses a Microdia driver, which from what I hear here may put me in a good position

ideally, i want to be able to show the view from the webcam on the lcd screen, and capture that image (either at screen res using imgtool or at full res using something like streamer
on a side note:
it'd be nice to have a binary repository of apps/utils that have been built for the chumby. is this part of the chumbyforge idea?

Re: webcam

The idea for chumbyforge (aka gforge.chumby.com) is to host both source and binaries.

Given the amount of clamoring by the developers for this system, only a small handful of folks are actually using it.  At this point, it doesn't justify the expense we're incurring for hosting it.

You could probably build lsusb for the chumby,however, I'm not sure it would do much, since (I believe) is simply outputs stuff it finds in /proc/bus/usb - however, the chumby's USB subsystem does not appear to supply that information

Re: webcam

ah, interesting
it looks a bit like the resource that there was for the linux sharp pda (zaurus 5500) that everyone used
give it time! it'll fill up!
could it share space on another server whilst it's resource overheads are low?

Re: webcam

Duane wrote:

...outputs stuff it finds in /proc/bus/usb - however, the chumby's USB subsystem does not appear to supply that information

It will supply that information if you mount the usbfs filesystem.

mount -t usbfs null /proc/bus/usb

(via)

Re: webcam

mikec wrote:
Duane wrote:

...outputs stuff it finds in /proc/bus/usb - however, the chumby's USB subsystem does not appear to supply that information

It will supply that information if you mount the usbfs filesystem.

mount -t usbfs null /proc/bus/usb

(via)

I got the following error when I tried this;

chumby:~# mount -t usbfs null /proc/bus/usb
mount: mounting null on /proc/bus/usb failed

I'm trying to figure out how to capture images from a USB webcam plugged into my Chumby1 and then move them to /www.  Perhaps, I already have all the information I need.  Below is the output from dmesg with the webcam plugged in;

................
[45724.280000] usb 1-1.1: new high speed USB device using fsl-ehci and address 5
[45724.440000] usb 1-1.1: configuration #1 chosen from 1 choice
[45725.000000] Linux video capture interface: v2.00
[45725.230000] uvcvideo: Found UVC 1.00 device USB 2.0 PC Cam (090c:b371)
[45725.250000] input: USB 2.0 PC Cam as /devices/platform/stmp3xxx-usb/fsl-ehci/usb1/1-1/1-1.1/1-1.1:1.0/input/input3
[45725.330000] usbcore: registered new interface driver uvcvideo
[45725.340000] USB Video Class driver (v0.1.0)
.......................
So it seems the webcam is ready to capture (???)

Somewhere else in the forum it was suggested to try;

cat /dev/video0 > /tmp/frame

and then figure out the file format.

I get ;
...........
chumby:~# cat /dev/video0 > /tmp/frame
cat: read error: No such device
............

Should I try to load an application like uvccapture onto the Chumby 1?
( http://www.quickcamteam.net/software/li … vccapture)

As an aside, I've searched through the Chumby forum for tips on connecting usb webcams to the Chumby and notice that the information is surprisingly scattered.  I realize that it's difficult to have a general answer for Linux webcam issues but perhaps a wiki article would be helpful.  I'll contribute as soon as I get something working.

Rich

Re: webcam

What happens if you run something like this:

while true; do dd if=/dev/video0 of=/tmp/img.jpg bs=64k count=1; imgtool --mode=draw /tmp/img.jpg; sleep 1; done

Re: webcam

ChumbyLurker wrote:

What happens if you run something like this:

while true; do dd if=/dev/video0 of=/tmp/img.jpg bs=64k count=1; imgtool --mode=draw /tmp/img.jpg; sleep 1; done

OK, here's the output (repeats until break);

...............
imgtool 1.22 (built for falconwing)
Drawing image /tmp/img.jpg
Empty input file
dd: /dev/video0: No such device
....................
does this help?
....
.chumby:~# ls -l /dev/video0
crw-rw----    1 root     root      81,   0 Dec 18 10:24 /dev/video0

......


I have quite a collection of USB webcams.  I could try them one-by-one.  This one however works great on Ubuntu 9.10 without fuss (apparently UVC) and has the best image quality.  I eventually will compile a list of what works.

Any other thoughts on with this cam?

I appreciate your super fast reply.

Rich

Re: webcam

Maybe it's showing up as /dev/video1?  It's interesting that at least the button on the camera (if there is one) is being properly detected.

Re: webcam

Success on Camera 6!!

here is what dmesg reports;

[  523.590000] usb 1-1.1: new full speed USB device using fsl-ehci and address 5
[  523.730000] usb 1-1.1: configuration #1 chosen from 1 choice
[  524.180000] gspca: main v2.3.0 registered
[  524.230000] gspca: probing 0ac8:301b
[  525.930000] zc3xx: probe 2wr ov vga 0x0000
[  525.970000] zc3xx: probe sensor -> 11
[  525.970000] zc3xx: Find Sensor HV7131R(c)
[  526.000000] gspca: probe ok
[  526.060000] usbcore: registered new interface driver zc3xx
...........

The imgtool script successfully created img.jpg in /tmp

..............
imgtool 1.22 (built for falconwing)
Drawing image /tmp/img.jpg
Opening output /dev/fb0 fmt=0
fb handle = 4
Displaying rows from 0 to 479 inclusive
Closing frame buffer
0+1 records in
0+1 records out
..................
The image looked fine except the exposure control seemed off.

The webcam, by the way, is made by "ViMicro" and is one of the few supported ICAMView webcam servers (probably embedded Linux based).  I bought it on Ebay from a Hong Kong seller for $3.95.  I've since tried to buy additional cams with this hardware ID but most sellers don't know or can't be bothered to find the ID.

I can post the negative results for the other 5 webcams if that would be helpful.

Regarding Cam (090c:b371), there wasn't a /dev/video1 that I could see but I'll take another look.  There is a button but I've never seen any applications that use it

I'm impressed that Chumby has the gspca drivers already loaded.  Good work!

Am I correct that other people are successfully using UVC webcams on their Chumby 1's?

Rich

Re: webcam

The button ought to show up, in your case, as /dev/input/event3.  If you do "hexdump /dev/input/event3" and then press the button, you should see input_event messages coming out.

From the looks of it, the uvc drivers don't support read()/write(), and must be communicated with using mmap() (source).  uvccapture will probably do that.  Since /dev/video0 is being created, it means the driver is successfully loading and it's being identified as a v4l device.  That's all very good.

Try uvccapture and see if it works.  I'd also be very curious about the other devices you tried, what type they are, and their failure modes.

Re: webcam

ChumbyLurker wrote:

  I'd also be very curious about the other devices you tried, what type they are, and their failure modes.

Here's a table of the webcams I tried.  I edited the dmesg output, perhaps deleting important details.  Sometimes dmesg wouldn't appear to change after hot swapping webcams so I rebooted each time to make sure.  The Philips IM camera seems like it should work but I repeated it 3 times without success.


http://justaddsquid.com/Pigcam/ChumbyWC.htm


(I couldn't figure out how to insert a table with BBCode so you will need to follow click on the link)

Running Uvccapture  on 090c:b371 in Ubuntu requires YUYV capture mode-not sure if that means anything.

Re: webcam

rleyden wrote:
mikec wrote:
mount -t usbfs null /proc/bus/usb

(via)

I got the following error when I tried this;

chumby:~# mount -t usbfs null /proc/bus/usb
mount: mounting null on /proc/bus/usb failed

Now that I have both Chumbys, I can clarify my comment: That command isn't necessary on the Chumby One, just the Chumby Classic. USB devices are already available via /proc/bus/usb on the Chumby One.

Re: webcam

ChumbyLurker wrote:

....Try uvccapture and see if it works.  .

I'm having a few problems getting uvccapture onto the C1.  I got the tool chain working and used the  lighttpd example for practice, everyhting worked fine.  It's taking me a while to work through getting a configure file for uvccapture that doesn't generate errors.  I'm sure I'll be ahead in the game when I finally figure it out.

Meanwhile, I've read that gstreamer should be able to handle webcams.  Gstreamer seems to already be loaded on the Chumby even though I couldn't find any discussion.  I therefore tried this using my  first webcam (090c:b371) ;

 gst-launch -v v4lsrc device=/dev/video0 ! filesink location=/tmp/video.out  

This actually ran for 10 -15 seconds before saying something like "out of memory" .  The video.out file (later transfered to /mnt/usb) was 5 Mb.  It has no header and I haven't been able to display it.  Strangely, I haven't been able to repeat this partial success.  I tried other variations such as;

 gst-launch v4l2src device=/dev/video0 ! jpegdec ! xvimagesink
or
gst-launch v4l2src device=/dev/video0 ! jpegdec ! filesink location=/tmp/img.jpg 

Here is the terminal output when it doesn't work (I didn't save it from the first time);
.........
chumby:/tmp# gst-launch -v v4lsrc device=/dev/video0 ! filesink location=/tmp/video.out
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
ERROR: from element /GstPipeline:pipeline0/GstV4lSrc:v4lsrc0: Could not get/set settings from/on resource.
Additional debug info:
v4l_calls.c(418): gst_v4l_set_chan_norm (): /GstPipeline:pipeline0/GstV4lSrc:v4lsrc0:
Error setting the channel/norm settings: Invalid argument
ERROR: pipeline doesn't want to preroll.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
..........

I'm not sure what was different the first time.  I had been trying to set up syslog for uvcvideo as;

modprobe uvcvideo trace=7 

Retracing my steps didn't seem to work.
I'll continue to struggle with uvccapture.  Perhaps, someone could suggest some gstreamer commands syntactically correct for the Chumby.

Re: webcam

Below is an update on working/non-working webcams on Chumby.  I'm not sure how useful a "not working" report is since a cam that didn't work for me may work for someone else with different programs or parameters.  Note that all the webcams below work under Ubuntu 8.10 using "Cheese".   Also, the UVC cams all work with uvccapture under Ubuntu.  I thought that was going to be my tip for someone looking to get a webcam for their Cumby However, even that qualification doesn't seem to apply.  There is much more variation in UVC than I thought.
UVC WEBCAMS:
Silicon Motion SM371, UVC (090c:b371): works with both ffmpeg and uvccapture (-m ) with resolution up to 800x600.

UVC 1.00 device Sirius USB2.0 Camera (0ac8:3330): Works with both ffmpeg and uvccapture (-m ) Max res.  640x480 (automatically defaults if higher res requested)

USB Web Camera (1c4f:3000) UVC:  Errors and no output both uvccapture and ffmpeg

UVC 1.00 device USB2.0 PC CAMERA (18ec:3290) ffmpeg doesn't work, uvccapture crashes (locked up) Chumby.

UVC 1.00 device USB2.0 PC CAMERA (18ec:3288): Errors and no output both uvccapture and ffmpeg.

OTHER WEBCAMS:

Phillips IM SN9C105 (vid:pid 0x0471:0x0328) errors and no output both uvccapture and ffmpeg

Vimicro, gspca: (0ac8:301b)  uvccapture saves picture but imgtool says "Bogus Huffman table definition"   ffmpeg doesn't work

Mi-Pixart, gspca ( 093a:2460), captures data (176x144) with uvccapture without reported errors but jpg file is corrupt.  ffmpeg doesn't work.

USING A HUB:
Everything worked as expected with 2 webcams (Sirius and Silicon Motion) plugged into a 4 port hub.  Either video0 or video1 could be specified with the "-d" option.

FURTHER THOUGHTS ON WEBCAMS:
As far as I know nobody designs webcams to work under Linux.  Philips gets gold stars from bloggers for publishing Linux drivers.  From my point of view, that doesn’t help much.  Most of my webcams were purchased on Ebay from Hong Kong sellers for less than $10, including shipping.  The manufacturer or the hardware ID is never disclosed.  The Silicon Motion webcam was a little more expensive ($14.99) because it was advertised as a “10 megapixel” webcam (5 MP actually w/Windows).  It’s a very nice webcam, good image quality and good exposure control.   Dipping into the mystery bin is cheap entertainment for me.  For $5 I feel free to case mod them, change lenses, or pull out the IR cut off filter.  The Mi was on sale at Fry’s for $9 before Christmas.  It has  terrible image quality.

15 (edited by rleyden 2010-02-07 23:30:17)

Re: webcam

I got fswebcam working on the Chumby.  Fswebcam captures images from several webcams which did not work properly with either ffmpeg or uvccapture.  Functionally, it is equivalent to uvccapture, capturing still images to a png or jpg file.  It can also do a few tricks such as averaging to reduce noise.  It uses GD libraries not used by the other two programs which may explain the different behavior.
On the release website, http://www.firestorm.cx/fswebcam/ , they note that the latest updates,   “ Corrected a number of memory leaks and a potential buffer overflow.”  We’ll see.

For example, a Logitech Quickcam IM (0x46d/0x8a6) was recognized by Chumby and uvccapture produced files without error warnings but all the images had a band of static at the top of a solid green field, without any real image.  Interestingly, the Quickcam and uvccapture had the exact same behavior in Ubuntu 9.10.  Fswebcam produced satisfactory images on both the Chumby and Ubuntu but with a thin red line at the bottom of the image in both cases.

The Quickcam also works with cheese on Ubuntu, which is gstreamer based.  I still haven’t figured out if the Chumby has all the gstreamer components already loaded to capture single images.

Re: webcam

I'm also trying to hook up a webcam; I have a logitech that seems to register as a valid v4l device. /dev/video0 is created and dmesg doesn't report any errors.

I'm having trouble on the software side. I tried to compile fswebcam, but it seems to require libgd, which I didn't see how to get onto the chumby.

Is this easier in the virtual development environment?

Also, here's what I'm getting with the above image script:

chumby:~# dd if=/dev/video0 of=/tmp/img.jpg bs=64k count=1
0+1 records in
0+1 records out
13140 bytes (12.8KB) copied, 2.394565 seconds, 5.4KB/s
chumby:~# imgtool --mode=draw /tmp/img.jpg 
imgtool 1.22 (built for falconwing)
Drawing image /tmp/img.jpg
Opening output /dev/fb0 fmt=0
fb handle = 4
Displaying rows from 0 to 479 inclusive
Corrupt JPEG data: premature end of data segment
Closing frame buffer

Re: webcam

schpyda wrote:

I'm also trying to hook up a webcam; I have a logitech ....

I was hoping a real Chumby expert would jump in and offer you help with your webcam.  I’ve got my webcams working on the Chumby but usually only by using bad linux stylistic form.  So, take warning.
I’m not surprised data copy from /dev/video doesn’t work for your Logitech webcam, my experience is that this rarely is a useful approach. 
Yes, you need additional libraries for fswebcam.  You can see this most easily by using the command, “ldd fswebcam”.   You should see ;

chumby:/psp# ldd fswebcam
        libgd.so.2 => /lib/libgd.so.2 (0x40026000)
        libc.so.6 => /lib/libc.so.6 (0x40072000)
        libjpeg.so.62 => /lib/libjpeg.so.62 (0x4019b000)h
        libfreetype.so.6 => /lib/libfreetype.so.6 (0x401c3000)
        libm.so.6 => /lib/libm.so.6 (0x40230000)
        /lib/ld-linux.so.3 (0x40000000)
        libz.so.1 => /lib/libz.so.1 (0x402dd000)

libgd.so.2 is the file you need.  My approach is to just copy this to /lib folder.  You will need to make the flash drive w/r  first;

mount -o remount,rw /

I recently purchased on Ebay a Logitech  Ultra Vision (046d:08c9) (supposed to be very good in low light-actually only just OK).  For some reason, this webcam doesn’t seem to work with Chumby+fswebcam but  works fine with Chumby+uvccapture.  For uvccapture you will need libjpeg.so.62.
I’m happy to put the Chumby binaries for fswebcam , uvccapture , and req. libraries in a download directory.  But, I’m not sure where.  Let me know if you need the binaries.

Re: webcam

@rleyden - thanks for the reply. I haven't set up a flash drive at all yet, I'm just doing the compiling directly on the chumby.

Where are you copying libgd.so.2 from?

I'm trying to compile fswebcam from source on the chumby (Insignia 3.5"), but when I run configure, it stops on:

checking for sys/param.h... yes
checking for getpagesize... yes
checking for working mmap... yes
checking for gdImageCreateTrueColor in -lgd... no
configure: error: GD graphics library not found

Re: webcam

schpyda wrote:

@rleyden -
Where are you copying libgd.so.2 from?

I compiled the libraries separately with some difficulty and then I realized I already had everything I needed after going through the examples (especially "Installing GD") given for setting up scratchbox ( http://wiki.chumby.com/mediawiki/index.php/Scratchbox ).  I faithfully followed the procedure line-by-line.

Scratchbox seems both magical and mysterious.  If the source code for new programs that I wanted for the Chumby included the automake files, everything went smoothly, if not, I was mostly lost.  I thought compling directly on the Chumby would be simplier and more fool-proof but it didn't work out that way.