Archived:Development: USB based video drivers
USB Video
see Em2820 for more informations about how to write an usb video driver
What we need from you to get your USB Device work
Requirements
this site explains how to get empiatech devices or similar running with linux by applying changes which might only work with your device.
Get usbsnoop for windows
http://benoit.papillault.free.fr/usbsnoop/
http://benoit.papillault.free.fr/stats/get.php?location=../usbsnoop/sniff-bin-1.1.zip
Set up usbsnoop and start sniffing
Before doing anything here start up your TV application and set it to the highest resolution (for em2820/em2840 devices the highest resolution should be 720x576 or 720x480 or 640x480?)
Follow these instructions:
Finally start up your TV application again, everything will slow down after it's started but it's worth doing it that way hardware analyzers cost a few thousand dollars...
after the sniffer recorded a few videoframes close the application again, compress the logfile, upload it somewhere or mail it to mrechberger@gmail.com. we'll then have a look at what's different with your device.
I wrote the parser below for generating code from the logfile,
a quick hack would be to paste the generated "em2820_write_regs_req()" codelines (which show up before UNABLE TO HANDLE ISOC TRANSFERS) at the end of the "static int em2820_config(struct em2820* dev)" function but before the return 0; line if you have any questions about it just join the #v4l on irc.freenode.org
hope everything's confusing enough now :)
#!/usr/bin/perl $urbrequest=0; $enabled=1; $setuppacket=0; while (<>){ # <<< URB 1 coming back <<< if(/>>>/){ if(/URB (\d{1,})/){ $urbrequest=sprintf("%06d",$1); } $enabled=1; $setuppacket=0; } if(/<<</){ if(/URB (\d{1,})/){ $urbrequest=sprintf("%06d",$1); } $enabled=1; $setuppacket=0; } if(/ISOCH_TRANSFER/){ $enabled=0; } if(/URB_FUNCTION_SELECT_INTERFACE/){ $selectinterface=1; } if($enabled==1){ if(/AlternateSetting = 0x(\d{1,})/){ push(@{$urbhash{$urbrequest}{'remark'}},"Changing to Alternative Setting 0x$1\n"); } if($setuppacket==1){ if(/0000: (.*)/){ if (@{$urbhash{$urbrequest}{'out'}} eq ""){ push(@{$urbhash{$urbrequest}{'out'}},$1); } else { push(@{$urbhash{$urbrequest+1000}{'out'}},$1); } } } else { if(/0000: (.*)/){ if (@{$urbhash{$urbrequest}{'in'}} eq ""){ push(@{$urbhash{$urbrequest}{'in'}},$1); } else { push(@{$urbhash{$urbrequest+1000}{'in'}},$1); } } } if(/SetupPacket.*/){ $setuppacket=1; } } else { ${$urbhash{$urbrequest}{'remark'}}[0]="don't know how to handle ISOCH_TRANSFER\n"; } } foreach $indexkey (sort keys %urbhash){ if($urbhash{$indexkey}{'remark'}[0] ne ""){ print $urbhash{$indexkey}{'remark'}[0]; next; } foreach $outkey (@{$urbhash{$indexkey}{'out'}}){ if(substr($outkey,0,1) eq "4"){ $outgoing=1; $reg=substr($outkey,12,2); $breq=substr($outkey,3,2); } else { $outgoing=0; } } if($outgoing == 1){ print "em2820_write_regs_req(dev,0x$breq,0x$reg,\""; foreach $inkey (@{$urbhash{$indexkey}{'in'}}){ $fullinkey=$inkey; $inkey=~s/[^A-Za-z0-9 ]//g; $inkey=~s/ *$//; # print "stripped inkey $inkey))"; @inarray=split(/ /,$inkey); $cntx=0; foreach $value (@inarray){ if(substr($value,0,1) ne " "){ # print "(".substr($value,0,1).")"; print "\\x$value"; $cntx++; } } print "\",$cntx);"; # print "($fullinkey vs $inkey)\n"; } } else { print "em2800_read_reg(dev,0x$breq,0x$reg);"; } print "\n"; }
Markus Rechberger/irc mrec