Pages

Thursday 25 October 2012

em28xx - RPi - archlinux-hf-2012-09-18

N.B. This doesn't work

Second attempt with a em28xx on Raspberry Pi... I'm so fucking bored of this not working I decided to do it again.


This is largely based on the first attempt...

http://bufobufomagic.blogspot.co.uk/2012/07/make-disk-image-mac-diskutil-list-sudo.html



 

build SD card (on a mac) and, probably, make it work


diskutil list

sudo diskutil unmountDisk /dev/disk1

dd if=/Users/michael/Desktop/RaspberryPi/Images/archlinux-hf-2012-09-18.img of=/dev/disk1 bs=1m


muck about with partitions - i expand the arch linux partition to 4Gb and call the remainder of the drive fat32.

fiddle with boot partition memory elves - rename original start elf and copy the 240 start elf as start.elf



then insert card, boot RPi and watch the LEDs dance about while you find it on the network.



mine was 85...

ssh 192.168.1.85 -l root (password root)

if this isn't your first time round the loop you might get a load of key verification errors, so do

ssh-keygen -R 192.168.1.85

and try again.

 
it is plugged in, right?

set up stuffs

swapdisk-u-like


mkdir -p /var/cache/swap/

dd if=/dev/zero of=/var/cache/swap/swapfile bs=1M count=1024

chmod 0600 /var/cache/swap/swapfile 
mkswap /var/cache/swap/swapfile
 
swapon /var/cache/swap/swapfile
put it in fstab, if you want to...
 
echo "/var/cache/swap/swapfile    none    swap    sw    0   0" >> /etc/fstab


...otherwise just remember to check it's on before you make the kernel.









upgradings






// if you like progress bars, this will give you the horn.

pacman -Syuand open a bottle of red wine.


install stuff

// because you want stuff

pacman -S ffmpeg motion git base-devel python2


Shall we reboot? Wouldn't be a bad idea. It will be nice to see it boot in a working state one more time...

do a kernel

get the kernel source


// are you doing this for fun? - because it isn't.





cd /home

git clone --depth 1 https://github.com/raspberrypi/linux.git

cd linux

zcat /proc/config.gz > .config



make menuconfig
( it appears i2c and em28xx stuff is all there now, but you can have a look for yourself)

muck about with the kernel


This is where you patch em28xx... https://patchwork.kernel.org/patch/1309461/

diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
index de2cb20..bed07a6 100644
--- a/drivers/media/video/em28xx/em28xx-core.c
+++ b/drivers/media/video/em28xx/em28xx-core.c
@@ -785,12 +785,8 @@ int em28xx_resolution_set(struct em28xx *dev)
     else
         dev->vbi_height = 18;

-    if (!dev->progressive)
-        height >>= norm_maxh(dev);
-
     em28xx_set_outfmt(dev);

-
     em28xx_accumulator_set(dev, 1, (width - 4) >> 2, 1, (height - 4) >> 2);

     /* If we don't set the start position to 2 in VBI mode, we end up

make the kernel

// I know we've been here before, just try and think positively

make



cd ..
 

git clone https://github.com/raspberrypi/tools

python2 imagetool-uncompressed.py /home/linux/arch/arm/boot/Image

mv /boot/kernel.img /boot/kernel.old


cp kernel.img /boot/kernel.img

cd /home/linux

make modules_install

reboot





ERRORS!


motion grumbles with;

[1] Unable to query input 1 VIDIOC_ENUMINPUT: Invalid argument
[1] ioctl (VIDIOCGCAP): Inappropriate ioctl for device
[1] Could not fetch initial image from camera
 




I suspect this is something to do with the wrong card id...

[    4.504130] em28xx #0: Your board has no unique USB ID and thus need a hint to be detected.
 

Here are the choices;

[    4.504215] em28xx #0: Here is a list of valid choices for the card=<n> insmod option:
[    4.504232] em28xx #0:     card=0 -> Unknown EM2800 video grabber
[    4.504248] em28xx #0:     card=1 -> Unknown EM2750/28xx video grabber
[    4.504264] em28xx #0:     card=2 -> Terratec Cinergy 250 USB
[    4.504279] em28xx #0:     card=3 -> Pinnacle PCTV USB 2
[    4.504293] em28xx #0:     card=4 -> Hauppauge WinTV USB 2
[    4.504307] em28xx #0:     card=5 -> MSI VOX USB 2.0
[    4.504321] em28xx #0:     card=6 -> Terratec Cinergy 200 USB
[    4.504335] em28xx #0:     card=7 -> Leadtek Winfast USB II
[    4.504350] em28xx #0:     card=8 -> Kworld USB2800
[    4.504365] em28xx #0:     card=9 -> Pinnacle Dazzle DVC 90/100/101/107 / Kaiser Baas Video to DVD maker / Kworld DVD Maker 2
[    4.504386] em28xx #0:     card=10 -> Hauppauge WinTV HVR 900
[    4.504401] em28xx #0:     card=11 -> Terratec Hybrid XS
[    4.504415] em28xx #0:     card=12 -> Kworld PVR TV 2800 RF
[    4.504429] em28xx #0:     card=13 -> Terratec Prodigy XS
[    4.504445] em28xx #0:     card=14 -> SIIG AVTuner-PVR / Pixelview Prolink PlayTV USB 2.0
[    4.504462] em28xx #0:     card=15 -> V-Gear PocketTV
[    4.504476] em28xx #0:     card=16 -> Hauppauge WinTV HVR 950
[    4.504490] em28xx #0:     card=17 -> Pinnacle PCTV HD Pro Stick
[    4.504506] em28xx #0:     card=18 -> Hauppauge WinTV HVR 900 (R2)
[    4.504521] em28xx #0:     card=19 -> EM2860/SAA711X Reference Design
[    4.504537] em28xx #0:     card=20 -> AMD ATI TV Wonder HD 600
[    4.504552] em28xx #0:     card=21 -> eMPIA Technology, Inc. GrabBeeX+ Video Encoder
[    4.504569] em28xx #0:     card=22 -> EM2710/EM2750/EM2751 webcam grabber
[    4.504585] em28xx #0:     card=23 -> Huaqi DLCW-130
[    4.504599] em28xx #0:     card=24 -> D-Link DUB-T210 TV Tuner
[    4.504613] em28xx #0:     card=25 -> Gadmei UTV310
[    4.504628] em28xx #0:     card=26 -> Hercules Smart TV USB 2.0
[    4.504643] em28xx #0:     card=27 -> Pinnacle PCTV USB 2 (Philips FM1216ME)
[    4.504659] em28xx #0:     card=28 -> Leadtek Winfast USB II Deluxe
[    4.504675] em28xx #0:     card=29 -> EM2860/TVP5150 Reference Design
[    4.504690] em28xx #0:     card=30 -> Videology 20K14XUSB USB2.0
[    4.504705] em28xx #0:     card=31 -> Usbgear VD204v9
[    4.504719] em28xx #0:     card=32 -> Supercomp USB 2.0 TV
[    4.504733] em28xx #0:     card=33 -> Elgato Video Capture
[    4.504748] em28xx #0:     card=34 -> Terratec Cinergy A Hybrid XS
[    4.504763] em28xx #0:     card=35 -> Typhoon DVD Maker
[    4.504777] em28xx #0:     card=36 -> NetGMBH Cam
[    4.504790] em28xx #0:     card=37 -> Gadmei UTV330
[    4.504804] em28xx #0:     card=38 -> Yakumo MovieMixer
[    4.504817] em28xx #0:     card=39 -> KWorld PVRTV 300U
[    4.504832] em28xx #0:     card=40 -> Plextor ConvertX PX-TV100U
[    4.504846] em28xx #0:     card=41 -> Kworld 350 U DVB-T
[    4.504860] em28xx #0:     card=42 -> Kworld 355 U DVB-T
[    4.504875] em28xx #0:     card=43 -> Terratec Cinergy T XS
[    4.504890] em28xx #0:     card=44 -> Terratec Cinergy T XS (MT2060)
[    4.504905] em28xx #0:     card=45 -> Pinnacle PCTV DVB-T
[    4.504919] em28xx #0:     card=46 -> Compro, VideoMate U3
[    4.504934] em28xx #0:     card=47 -> KWorld DVB-T 305U
[    4.504948] em28xx #0:     card=48 -> KWorld DVB-T 310U
[    4.504962] em28xx #0:     card=49 -> MSI DigiVox A/D
[    4.504976] em28xx #0:     card=50 -> MSI DigiVox A/D II
[    4.504990] em28xx #0:     card=51 -> Terratec Hybrid XS Secam
[    4.505005] em28xx #0:     card=52 -> DNT DA2 Hybrid
[    4.505019] em28xx #0:     card=53 -> Pinnacle Hybrid Pro
[    4.505033] em28xx #0:     card=54 -> Kworld VS-DVB-T 323UR
[    4.505048] em28xx #0:     card=55 -> Terratec Cinnergy Hybrid T USB XS (em2882)
[    4.505064] em28xx #0:     card=56 -> Pinnacle Hybrid Pro (330e)
[    4.505079] em28xx #0:     card=57 -> Kworld PlusTV HD Hybrid 330
[    4.505094] em28xx #0:     card=58 -> Compro VideoMate ForYou/Stereo
[    4.505109] em28xx #0:     card=59 -> (null)
[    4.505123] em28xx #0:     card=60 -> Hauppauge WinTV HVR 850
[    4.505138] em28xx #0:     card=61 -> Pixelview PlayTV Box 4 USB 2.0
[    4.505153] em28xx #0:     card=62 -> Gadmei TVR200
[    4.505167] em28xx #0:     card=63 -> Kaiomy TVnPC U2
[    4.505181] em28xx #0:     card=64 -> Easy Cap Capture DC-60
[    4.505196] em28xx #0:     card=65 -> IO-DATA GV-MVP/SZ
[    4.505210] em28xx #0:     card=66 -> Empire dual TV
[    4.505223] em28xx #0:     card=67 -> Terratec Grabby
[    4.505237] em28xx #0:     card=68 -> Terratec AV350
[    4.505252] em28xx #0:     card=69 -> KWorld ATSC 315U HDTV TV Box
[    4.505267] em28xx #0:     card=70 -> Evga inDtube
[    4.505281] em28xx #0:     card=71 -> Silvercrest Webcam 1.3mpix
[    4.505296] em28xx #0:     card=72 -> Gadmei UTV330+
[    4.505310] em28xx #0:     card=73 -> Reddo DVB-C USB TV Box
[    4.505325] em28xx #0:     card=74 -> Actionmaster/LinXcel/Digitus VC211A
[    4.505340] em28xx #0:     card=75 -> Dikom DK300
[    4.505354] em28xx #0:     card=76 -> KWorld PlusTV 340U or UB435-Q (ATSC)
[    4.505371] em28xx #0:     card=77 -> EM2874 Leadership ISDBT
[    4.505386] em28xx #0:     card=78 -> PCTV nanoStick T2 290e
[    4.505400] em28xx #0:     card=79 -> Terratec Cinergy H5
[    4.505415] em28xx #0:     card=80 -> PCTV DVB-S2 Stick (460e)






It's supposedly a kworld 2800USB, so i'll try 8

modprobe -r em28xx
modprobe em28xx card=8


doesn't work, hangs on Resizing pre_capture buffer to 1 items - which i think is an improvement. card=19 doesn't work either, same error - although i have a feeling that's how it has turned up in the past.







New drivers?

cd /home

mkdir stuff

wget http://aur.archlinux.org/packages/pe/perl-proc-processtable/perl-proc-processtable.tar.gz


wget http://aur.archlinux.org/packages/pe/perl-proc-processtable/PKGBUILD

makepkg --asroot -s

pacman -U perl-proc-processtable-0.45-3-any.pkg.tar.xz

pacman -S patchutils

cd /home

git clone git://linuxtv.org/media_build.git

cd media_build

./build


the build failed on smiapp-core.c
at this point I  make menuconfig and start removing stuff
then try to make it again.

make install 


 this seemed to work now

reboot 


but the driver still doesn't. I'm giving up on this board for a while.

6 comments:

  1. Just to let you know that someone is keeping an eye on what you are doing!

    My RPi is also gathering dust. Every couple of weeks I boot the old girl up with the latest software, hoping it will run properly with my webcams (once it does this, I'll start looking at the EasyCap, but can't see much point until the basics have been fixed).

    I was really hoping this would all be sorted out in good time for the 2013 bird box season, but its looking very unlikely. So I just gotta hope my very old Compaq D510 system has a few more months of life left.

    If/when you do get a stable capture, don't forget to post!

    ReplyDelete
  2. Thanks for the moral support Steve!

    I think a fix may be some time coming for the RPi... I just thought i'd have a go with the arch image while I wait for my Olimex A13 to appear. Think the via apc might be of interest too.

    There is talk of the funding actually coming through now, so I've also been looking at some bigger toys too;
    http://www.ampltd.com/pc104/proc/tiny-lx2.php
    http://www.ampltd.com/pc104/video/quadgrabber.php

    Have you thought about something like the D525 and a pci capture card? It isn't quite efficient enough for me - but it's not bad.

    http://www.intel.com/content/www/us/en/motherboards/desktop-motherboards/desktop-board-d525mw.html

    ReplyDelete
    Replies
    1. I hope the "talk" of funding turns into action. As a kid growing up in Essex, I used to spend a lot of time observing the creatures in our garden. Our pond was always "alive" with newts (rarely saw any frogs) and I once remember seeing a huge dark creature a couple of inches below the water, with yellow spots on its fingers/toes which I assumed at the time was a salamander, because it didn't have a crest...but maybe I hadn't seen a female great crested newt before (guess I'll never know what it was).

      We also used to have lots of lizards, even right outside our back door! Those days are long-gone. Sadly, the only lizards in Essex now are the "lounge" variety, their habitat includes the bars & clubs of Southend, Benfleet & Basildon.

      Yeah, there are quite a few small low power boards available. When I was still working in industry I used a Advantech Geode powered pc104 running WinNT embedded on a non-invasive temperature measurement system (most objects emit microwave energy, which increases as the temp rises). We also used a low cost board from http://www.mansky.co.uk/sbc.html on an in-line metal scanner. The guys at ManSky were very helpful, so might be useful if you are going to build a small batch of monitors.

      The D510 I use with my bird box setup is quite low power, but as its typically on all the time from the beginning of February to the end of July, I can see a big saving in power by using the RPi. I could also use more than one RPi, rather than switching cameras into a single ExCap & computer.

      Delete
  3. Thanks for the link... i'll investigate the Mansky boards. I've looked at a couple of advantech boards... but they are not really interested in talking to a little fish like me. Amp have been really helpful - but there advice is the development time for their board probably would be feasible, and I should be looking at better quality usb capture devices...

    ...of course, as you're almost certainly aware, most of the better cards (eg pinnacle) are also em28xx based and may not work on arm. I've had a look at Sundtek devices - they support linux - but they out of stock until January according to their site.

    it was the arm issues that got me thinking about x86 boards or PCIe capture devices.... but that additional power consumption is going to cost dearly. I should probably concentrate on fixing em28xx on a different arm board.

    I grew up in Bedfordshire, and my childhood memories are similarly disheartening. None of the papers I've read on amphibians and roads make for cheerful reading either.

    Salamanders are mainly terrestrial, and don't tend to crop up among the introduced/invasive species to the UK - so I'm guessing we are too far out of their range, and they can't survive our winter... but, longevity not-with-standing, I wouldn't rule out finding anything out and about that is found in a pet shop.

    ReplyDelete
  4. Hey,

    I have been reading up on getting an em28xx tuner to work with a raspberry, a WinTV 930C in my case. It seems that there are currently a couple of issues related to the Raspberry pi's firmware that will prevent isochronous USB transfers to work correctly. Main problem here is that the upstream em28xx driver only suppported isochronous transfers.

    http://www.mail-archive.com/linux-usb@vger.kernel.org/msg04232.html

    However a set of patches was released last week adding bulk transfer mode for em28xx which could possibly allow you to use such a chipset with the Rasp. First testing did not show good results but this was due to the fact that the raspberry pi did not create any bulk usb endpoints for the tuner. I'm not really sure if there's a way to accomplish this, but maybe someone else with more experience knows how to accomplish this?

    http://www.mail-archive.com/linux-media@vger.kernel.org/msg54590.html

    ReplyDelete
  5. Thanks for the update Jeroen. I haven't been following linux-media lately so I missed this. I have, however, received an email the other day from a 'someone else' regarding stk1160 and bulk transfer. I guess em28xx is being looked at too, although it's just a waiting game for the likes of me now. So there's hope. I'm looking at the beagleboard xM next. Besides the addition cost of the board, there's the obvious, and substantial, hike in power consumption... and I'll have my fingers crossed for a RPi fix too.

    ReplyDelete

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License