Skip to contentSkip to conversation

v4l parent for usb device interface or device?

DISCUSSION Hans de Goede 2 participants 2 messages Mar 25, 2009 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

<take 2 this time to the new list, hoping it gets some more attention>

Hi,

Today it came to my attention (through a libv4l bugreport) that the uvc driver and the gspca driver handle the setting of the v4l parent for usb webcams differently.

The probe function for an usb driver gets passed in a "struct usb_interface *intf" parameter.

uvc sets parent to:

vdev->parent = &intf->dev;

gspca uses:
struct usb_device *dev = interface_to_usbdev(intf); vdev.parent = &dev->dev;

Looking at what for example the usb mass-storage driver does (with my multi function printer/scanner with cardreader), which matches UVC, and thinking about how this is supposed to work with multifunction devices in general, I believe the uvc driver behaviour is correct, but before writing a patch for gspca, I thought it would be good to first discuss this on the list.

So what do you think ?

Thanks & Regards,

Hans

p.s.

This mainly influences what the /sys/class/video4linux/video#/device symlink will point to, which libv4l uses.

#1 lore raw

Hi Hans,

Quoted 27 lines · On Wednesday 25 March 2009 11:18:31 Hans de Goede wrote:

<take 2 this time to the new list, hoping it gets some more attention>

Hi,

Today it came to my attention (through a libv4l bugreport) that the uvc driver and the gspca driver handle the setting of the v4l parent for usb webcams differently.

The probe function for an usb driver gets passed in a "struct usb_interface *intf" parameter.

uvc sets parent to:

vdev->parent = &intf->dev;

gspca uses:
struct usb_device *dev = interface_to_usbdev(intf); vdev.parent = &dev->dev;

Looking at what for example the usb mass-storage driver does (with my multi function printer/scanner with cardreader), which matches UVC, and thinking about how this is supposed to work with multifunction devices in general, I believe the uvc driver behaviour is correct, but before writing a patch for gspca, I thought it would be good to first discuss this on the list.

Quoted 1 line

So what do you think ?

I obviously agree with you :-)

USB class drivers bind to interfaces instead of devices to support composite (multifunction) devices. While drivers for vendor-specific USB devices can bind to the device, in which case the parent could be a USB device, we need to have some consistency in the sysfs symlinks. Using a USB interface as the video device parent regardless of the device type makes sense.

Best regards,

Laurent Pinchart