[pvrusb2] Next sysfs oddity

Mike Isely isely at isely.net
Wed Jan 28 20:29:04 CST 2009


On Thu, 29 Jan 2009, Carsten Meier wrote:

> Hi Mike,
> 
> shouldn't there be a symlink named "device" to the actual
> sysfs-usb-device-directory in
> the /sys/class/video4linux/video*/-directory? (at least other
> v4l-devices have one, according to Markus's post on the old v4l-list) I
> think the missing symlink prevents HAL from recognizing the pvrusb2 as
> a video4linux-device here.

In order for the V4L core to know about the underlying USB device, the 
driver (i.e. pvrusb2) must tell it, by dropping a pointer to the 
underlying device structure into the V4L device's structure.  This 
effectively exposes an "implementation detail" of the driver to the V4L 
core.  Right now the pvrusb2 driver does not do this.  The reason why is 
because I have not had a chance to investigate what might happen if the 
device is hot-unplugged while this linkage exists.  Right now the 
pvrusb2 driver is able to "let go" of the USB device immediately upon 
hotplug removal while the V4L side can stick around longer.  It's done 
this way to allow proper tear-down - the hardware can go away without 
delay and the driver will mediate things correctly while waiting for any 
app with the driver open to finally exit.  The V4L core can't really 
remove itself until the app closes, so if it is also holding onto a 
pointer to that now-deleted USB device structure (remember, I said this 
was an "implementation detail" of the driver) then a potential exists 
for a dangling pointer and an oops.

I don't know _for sure_ if this is the case.  I need to investigate it.  
And it hasn't been a priority.  But I'm not going to change anything 
here until I can be sure it is safe to do.

  -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