[pvrusb2] Problem with wintv-hvr-1950

Mike Isely isely at isely.net
Sat Mar 14 12:21:34 CDT 2009


On Fri, 13 Mar 2009, jim steele wrote:

> I have gotten this working consistently now. I changed the
> /lib/udev/firmware.sh from this:
> 
>         echo 1 > /sys/$DEVPATH/loading
>         cat "$DIR/$FIRMWARE" > /sys/$DEVPATH/data
>         echo 0 > /sys/$DEVPATH/loading
> 
> to this:
> 
>         echo 1 > /sys/$DEVPATH/loading
>         cat "$DIR/$FIRMWARE" > /sys/$DEVPATH/data
>         cat /sys/$DEVPATH/data > /home/root/debug
>         echo 0 > /sys/$DEVPATH/loading
> 
> and it started working. I think that maybe because this is on an SD
> card file system that the /sys/$DEVPATH/data file wasn't completely
> finished writing somehow before the echo 0 command was issued. The
> fact that I added another cat of the same file to a debug location
> seems to have given it time to catch up and when the echo 0 command is
> issued, the firmware is completely there. I changed the debug line to
> 'sleep 1' just to clean it up and it works great.

This is alarming.  The problem has nothing directly to do with the 
pvrusb2 driver but it makes me wonder if you've encountered a 
sysfs-related kernel bug.  The fact that the firmware came from an SSD 
should not have any bearing in the above code - because the read from 
the SSD *MUST* be completed by the time that first cat command finishes.  
There's simply no other possibility there because the file contents have 
to travel *through* the cat program itself.  Once that program finishes, 
the transfer from the SSD has no choice but to be done.  If there's a 
race going on here, it has to be some kind of synchronization thing 
between the writing of the "data" node and the second write into the 
"loading" node.  Those are both sysfs nodes so the problem can only be 
in the kernel.

The addition of the second cat command adds delay, as you point out.  I 
wonder if you just put a "sleep 1" command there if that would also 
work.  I suspect it will - further evidence of a kernel problem.


> 
> Thanks for your help on this, and also thanks for the record script
> sample, that is really useful to me.

Good luck.

  -Mike


-- 

Mike Isely
isely @ pobox (dot) com
PGP: 03 54 43 4D 75 E5 CC 92 71 16 01 E2 B5 F5 C1 E8


More information about the pvrusb2 mailing list