Re: device emulator?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 9 Aug 2011, Chris Furlough wrote:

> > No, that's not what you want.  You want your driver to emulate the
> > hardware device currently under development.  Registration with usbfs
> > is handled entirely within the host, so it has nothing to do with your
> > driver.
> 
> Guys, the problem is, I already have this part working.  My only hang-up 
> right now is that I don't get IOCTLs passed to me.  I get 
> open/release/read/writes, but not IOCTLs.

Look, the software you seem to be describing makes no sense in the 
context you talked about.  You appear to be describing a kernel driver 
that registers a usb_driver structure.  Is that correct?  Such a driver 
won't get used unless it binds to a USB device -- so what device does 
your driver bind to?  You already said that the hardware hasn't been 
developed yet.

Since the overall background for your question is unclear, I'll simply
answer the question in the narrowest possible terms.  When a user
program calls ioctl() for a usbfs file, the ioctl is passed down to
the device driver only if the ioctl's request code is USBDEVFS_IOCTL.  
In that case, the ioctl's third argument must be a pointer to a
usbdevfs_ioctl structure.  The driver will receive a pointer to the
interface, the "ioctl_code" member of the structure, and a pointer to a
kernel buffer containing a copy of the contents of the "data" member.

(Also, the ioctl_code member must not be equal to USBDEVFS_DISCONNECT 
or USBDEVFS_CONNECT; those codes aren't passed down to the driver but 
are handled directly in usbfs.)


> > You can do what you want by using the Gadget framework.  See
> > include/linux/usb/gadget.h and <http://www.linux-usb.org/gadget/>.
> 
> I don't really want to start over when I'm THIS close to being done.  Hope 
> this makes sense. 

Not really, but maybe my answer will help.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux