From: David Brownell <david-b@pacbell.net>
To: Martin F Krafft <krafft@ailab.ch>
Cc: linux-kernel@vger.kernel.org
Subject: Re: failing to force-claim USB interface
Date: Mon, 19 Jan 2004 10:04:09 -0800 [thread overview]
Message-ID: <400C1C19.4090502@pacbell.net> (raw)
> I am trying to make use of the usbfs USBDEVFS_DISCONNECT ioctl, and
> I am failing.
Appended, see a snippet of code which worked reliably way back on
the original 2.4 patch. Maybe you tripped on the precondition?
Or maybe this is just broken so far in 2.6.
A fair amount of usbfs code is at least slightly broken in 2.6;
some usbcore driver model changes are still needed in the area
of this particular ioctl. (Which got mangled more than most
during its evolution.) Was this with a 2.6.1 kernel?
I'm thinking this kind of thing ought to be generically doable
with sysfs, maybe with symlink/unlink syscalls between device
and driver nodes.
- Dave
if (ioctl (fd, USBDEVFS_CLAIMINTERFACE, &ifno) < 0) {
#ifdef USBDEVFS_DISCONNECT
int saved_errno = errno;
struct usbdevfs_ioctl command;
int retval;
/*
* maybe we need to boot a kernel driver off before we
* can bind to this. a "polite" unbind might be nice;
* for now we expect apps to adopt a reasonble policy,
* checking if it's claimed already (when it matters).
*/
if (saved_errno != EBUSY)
return -errno;
command.ifno = ifno;
command.ioctl_code = USBDEVFS_DISCONNECT;
command.data = 0;
retval = ioctl (fd, USBDEVFS_IOCTL, &command);
if (retval < 0)
return -saved_errno;
if (ioctl (fd, USBDEVFS_CLAIMINTERFACE, &ifno) < 0)
return -errno;
#else
return -errno;
#endif
}
return 0;
next reply other threads:[~2004-01-19 17:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-19 18:04 David Brownell [this message]
-- strict thread matches above, loose matches on Subject: below --
2004-01-19 15:46 failing to force-claim USB interface Martin F Krafft
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=400C1C19.4090502@pacbell.net \
--to=david-b@pacbell.net \
--cc=krafft@ailab.ch \
--cc=linux-kernel@vger.kernel.org \
/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