libftdi Archives

Subject: PATCH: Propagate libusb device node permission errors to application

From: "Ryan C. Underwood" <nemesis-lists@xxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Cc: marshallgs@xxxxxxxxx
Date: Fri, 16 Nov 2012 11:10:00 -0600
Hi,

This patch fixes misleading errors being sent to the application from
libftdi.

Background: usb_open() will silently succeed when the device node can
only be opened read-only and not read-write.  When this occurs,
various subsequent ioctls to that node will fail, and are presented to
the application as failures of those specific operations, even though
the root cause is a permissions error.

Using usb_claim_interface after every usb_open() would reveal a
permissions problem earlier, but it is desirable in this case to scan
properties of USB devices to find FTDI chips without necessarily
attempting to claim every device for exclusive access.

The patch ensures that when libftdi performs a libusb operation on an
opened but not claimed USB device, a failure due to a permissions
error will be propagated to the application as a permissions error and
not a different, red-herring error.

-- 
Ryan C. Underwood, <nemesis@xxxxxxxxxxxx>

Attachment: ftdi.c.eperm.patch
Description: Text Data

Attachment: signature.asc
Description: Digital signature

Current Thread