From: Grant Likely <grant.likely@secretlab.ca>
To: Stefan Agner <stefan@agner.ch>, Stefan Agner <stefan@agner.ch>,
johan@kernel.org, linus.walleij@linaro.org, gnurou@gmail.com,
gregkh@linuxfoundation.org, x-linux@infra-silbe.de,
hachti@hachti.de, linux-usb@vger.kernel.org,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/2] FTDI CBUS GPIO support
Date: Sun, 23 Aug 2015 01:52:53 -0700 [thread overview]
Message-ID: <20150823085253.D9178C40941@trevor.secretlab.ca> (raw)
In-Reply-To: <a35f48994dedc061b54ca9ea255fdd4e@agner.ch>
On Sun, 21 Jun 2015 21:44:30 +0200
, Stefan Agner <stefan@agner.ch>
wrote:
> On 2015-06-21 01:49, Peter Stuge wrote:
> > Stefan Agner wrote:
> >> libftdi requires to detach the kernel driver to get access to the device
> >
> > Control transfers ought to be possible without a detach.
>
> Good to know, thanks for this input. The detach is probably a default
> behavior of libftdi... Will have a look at that.
libftdi is built on libusb. libusb detaches the device from ftdi_sio and
binds it to a special driver for userspace access. There may indeed be
another way to do it, but libusb doesn't know how to do it AFAIKS.
We can't avoid the detach on current libftdi, but I do have a patch to
libftdi that will at least reconnect the ftdi_sio driver after userspace
has finished. I'll be posting it to the libftdi list in the next week,
but I've attached it below for anyone who wants to play.
> Having kernel level gpiolib would still have advantages: It would make
> the matching of the GPIO's and tty device easier, since with this patch
> the gpiolib device is a sub-node of the usb-serial device in sysfs and
> the user would have to use kernel interfaces only (no libftdi)...
NAK on the sysfs interface. Don't add a new ABI. gpiolib is the right
way to expose these pins.
g.
---
Subject: [PATCH] Automatically reattach kernel driver on close
The built-in libusb auto detach feature supports automatically
reattaching the kernel driver when the device is closed. Switch libftdi
to use the libusb auto-detach code so that we can get the Linux ftdi_sio
driver reattached automatically when finished with the device.
---
src/ftdi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/ftdi.c b/src/ftdi.c
index 68489ea096be..0d043690aeca 100644
--- a/src/ftdi.c
+++ b/src/ftdi.c
@@ -548,7 +548,7 @@ int ftdi_usb_open_dev(struct ftdi_context *ftdi, libusb_device *dev)
// Likely scenario is a static ftdi_sio kernel module.
if (ftdi->module_detach_mode == AUTO_DETACH_SIO_MODULE)
{
- if (libusb_detach_kernel_driver(ftdi->usb_dev, ftdi->interface) !=0)
+ if (libusb_set_auto_detach_kernel_driver(ftdi->usb_dev, 1))
detach_errno = errno;
}
--
2.1.4
next prev parent reply other threads:[~2015-08-23 20:22 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-20 22:12 Stefan Agner
2015-06-20 22:12 ` [PATCH 1/2] USB: ftdi_sio: add CBUS mode for FT232R devices Stefan Agner
2015-06-30 6:46 ` Linus Walleij
2015-06-30 6:54 ` Johan Hovold
2015-06-20 22:12 ` [PATCH 2/2] gpio: gpio-ftdi-cbus: add driver for FTDI CBUS GPIOs Stefan Agner
2015-07-15 7:42 ` Linus Walleij
2015-06-20 23:49 ` [PATCH 0/2] FTDI CBUS GPIO support Peter Stuge
2015-06-21 19:44 ` Stefan Agner
2015-08-23 8:52 ` Grant Likely [this message]
2015-06-21 2:22 ` Philipp Hachtmann
2015-06-21 19:39 ` Stefan Agner
2015-06-22 17:26 ` Johan Hovold
2015-06-22 20:11 ` Stefan Agner
2015-06-23 9:22 ` Johan Hovold
2015-06-23 22:08 ` Stefan Agner
2015-06-24 7:56 ` Johan Hovold
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150823085253.D9178C40941@trevor.secretlab.ca \
--to=grant.likely@secretlab.ca \
--cc=gnurou@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=hachti@hachti.de \
--cc=johan@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stefan@agner.ch \
--cc=x-linux@infra-silbe.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®