I do have task of writing a USB device driver , which should be
easily portable across platform and operating system.I was tried
googling , I couldnt get much information regarding that.
I read the whole USB architecture , and understood that only USB Host
controller driver is platform dependent. USB core and USB class are
platform Independent.
So I do have feeling that , I can write USB device driver which is
platform independent and easily portable across Operating Systems.
Is it possible?
Any guides to do that?
I've never seen one of these platform portable device drivers before.
What do you mean by "platform portable" ? is this like portable across
Windows/Linux/HPUx type of thing. Let me know if you find one!!
Is this a device driver for host side USB (Such as a System On Chip)
or a client side USB (such as a CommunicationDeviceControl (CDC)) ?
Almost all operating systems provides Platform specific Host
controller drivers and platform INDependent USB core(or equivalent)
and USB Class drivers.Normally we have to write USB device drivers on
top of USB class drivers, which is also platform(or operating system)
INDependent.
Suppose I write a driver on linux on a known class ( eg: Storage
class) .
Can I easily port the same driver on windows too?
Because even windows provides ,
host controller driver ( usbport.sys )
USB Core ( called USB Bus Driver = usbhub.sys )
USB common class driver ( usbccgp.sys ) etc
So architecture is pretty common , with some differences.
So , what I feel is , with little effort , drivers can be easily
ported across the platforms !!
I need some expert input regarding this
Maybe he can write a user-space USB driver upon libusb, which can support
several OS.
Not all the operating systems support that.
Even in windows only vista can provide usermode driver in the form of
WinUSB.
On Dec 22, 6:16 pm, Jike Song <albca...@gmail.com> wrote:
Unfortunately, this is not true. Drivers in general, and USB drivers in
particular, are system-specific. There's just no way around it. Kernel
services are not standardized, nor are the device models.
>Normally we have to write USB device drivers on
>top of USB class drivers, which is also platform(or operating system)
>INDependent.
Again, this is not true. USB classes might be system-independent, but
their drivers are not.
The CONCEPTS are similar. The USB spec actually uses terms like URB (USB
Request Block) and IRP (I/O request packet), and those concepts exist in
Windows and Linux, but the operation is quite different.
>Suppose I write a driver on linux on a known class ( eg: Storage
>class) .
If you have a device that meets one of the standard USB classes (Storage,
Audio, HID, Video, Net, Comm, etc), then you do not write a driver AT ALL.
The major operating systems all provide drivers for those devices
automatically. Those class drivers then expose those standard services in
whatever way is customary for that system.
>Can I easily port the same driver on windows too?
>Because even windows provides ,
>host controller driver ( usbport.sys )
>USB Core ( called USB Bus Driver = usbhub.sys )
>USB common class driver ( usbccgp.sys ) etc
>
>So architecture is pretty common , with some differences.
The concepts are common. The operation is very different.
>So , what I feel is , with little effort , drivers can be easily
>ported across the platforms !!
>
>I need some expert input regarding this
You are, unfortunately, incorrect.
There is a library called "libusb" that can allow a user-mode application
to act as a device driver for generic USB devices, and it is (more or less)
compatible across several operating systems. However, libusb uses the
generic USB driver on Linux, and installs its own generic USB driver on
Windows.
--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.
libusb provides some wrappers to the underlying OS device drivers so
that user space apps can access lower level USB functionality. I
would NOT call it a user space device driver. I would consider X.org
to contain some user space device drivers to access specific features
of graphics cards. Note the difference here. Xorg drivers maps the
HW registers to its memory space and punches values directly to them.
AFAIK libusb uses the OS provided root hub interface to do low level
USB comms. The interaction between HW and software still happens in a
controlled manner through the OS provided device driver.
As Tim points out libusb installs its own generic device driver in
windows (that sometimes stuffs up windows native USB functionality).
But this part of libusb is never portable; its windows specific. I
wouldn't call the portable bits of libusb a "user space device
driver". Its just a easy access wrapper.
Thank you very much. This is exactly the answer I was Looking for. It
was very precise answer indeed.
On Dec 23, 7:52 am, Tim Roberts <t...@probo.com> wrote:
> Tim Roberts, t...@probo.com
> Providenza & Boekelheide, Inc.
The problem is that the question isn't very meaningful. Both systems use
URBs (USB Request Blocks) to send requests to the host controller driver.
Beyond that, they aren't very much alike. You can go look at the source
code for the Linux kernel; the "generic" USB driver (which libusb uses) in
Linux is in src/drivers/usb/core/devio.c. It accepts ioctls from user
mode, and creates URBs to send to the host controller driver.
I have to disgree with you, because this kind of assertion raises the hopes
of USB beginners who think they can whack their USB devices just like
reading from a disk file. We see this all the time on the libusb mailing
list.
Libusb provides an interface that is much like WinUSB on Windows. Neither
of them are extra-friendly easy access wrappers. Both are just mappings of
the kernel-level interfaces to user-mode. In order to use either libusb or
WinUSB successfully, you really do have to write a user-mode device driver.
You have to understand descriptors, classes, interfaces, endpoints, pipes,
packets, frames, URBs, and control messages. It requires a level of
expertise that I associate with "device drivers", not "easy access
wrappers".
http://www.jungo.com/st/windriver_usb_pci_driver_development_software.html
However better way would be create linux GPL driver with
community. If you provide hardware documentation,
people from linux driver project will write linux driver
for you in the right way - your device will be supported
in current and futher linux kernel releases.
So you could concentrate on widnows and other OS driver.
See here about LDP:
http://www.linuxdriverproject.org/twiki/bin/view
Stanislaw Gruszka
> Libusb provides an interface that is much like WinUSB on Windows. Neither
> of them are extra-friendly easy access wrappers. Both are just mappings of
> the kernel-level interfaces to user-mode. In order to use either libusb or
> WinUSB successfully, you really do have to write a user-mode device driver.
> You have to understand descriptors, classes, interfaces, endpoints, pipes,
> packets, frames, URBs, and control messages. It requires a level of
> expertise that I associate with "device drivers", not "easy access
> wrappers".
What you are describing here is the standard USB communications and
infrastructure formats as described in Chapter 8 (as I could remember)
on the USB spec. Who ever uses Libusb surely needs to understand how
USB works. But as far as I am concerned that code does NOT become a
"User space device driver" just because it has to comply with USB
communications spec. As far as I know libUsb based user code does not
have Hardware specific interactions nor time critical response needs
nor interrupts. All of these gets handled on the lower level native
device driver.
Cheers
Janaka
USB drivers do not worry about hardware-specific interactions like DMA,
physical memory and interrupts, either . That's all done by the host
controller driver.
There is, in fact, virtually no difference between a kernel USB driver and
a libusb application, other than the names of the APIs that are used. I've
written many of both.