On Mon, Jun 6, 2011 at 1:56 PM, Hans de Goede <hdego...@redhat.com> wrote:
> Hi,
>
> While working on my cleanup / v4l2 compliance series for
> the pwc driver I've noticed that the pwc and gspca drivers
> are doing different things wrt what error they return to
> an app is using the device while it gets unplugged.
> gspca returns -ENODEV, where as pwc returns -EPIPE.
>
> Both make some sense. I've not looked at what other
> usb (or other hotplug capable bus) v4l2 drivers do, but
> it makes sense to me to standardize on an error here,
> preferably a reasonable unique one so that apps can
> detect unplug versus other errors. Note that the usb
> subsystem returns -ENODEV when you try to (re)submit
> an urb from its completion handler, when that
> completion handler gets called because the urb was
> unlinked because of device unplug.
>
> Given that we often return usb error codes unmodified
> and the usb subsys uses -ENODEV for trying to do things
> with unplugged devices, I guess it makes sense for
> us to also use -ENODEV.

I'm pretty sure ENODEV is what gets returned today if you attempt to
open a /dev/videoX node for a device that has been disconnected but
the device node hasn't yet been removed.  So I would agree that ENODEV
is a good choice for the scenario you described.

Devin

-- 
Devin J. Heitmueller - Kernel Labs
http://www.kernellabs.com
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to