From: nexolite on
Hi... What work/study path you recommend to become a good device driver
programmer ?

Thanks

"Joseph M. Newcomer" wrote:

> You have not actually said what you mean by "USB interface". For example, if the device
> comes with a USB cable to connected it, it MUST have a WIndows driver that connects to
> that device. In which case, you will know the device name to open and you will open that
> device and use ReadFile and WriteFile to talk to it, in accordance with the interface
> specs.
>
> If you are working for the company that produces the equipment, be aware that they will
> have to write a Device Driver tha communicates to this device. This can be done as a
> kernel-mode driver using KMDF, or a user-mode driver using UMDF, but the important part
> here is that it must be design and written, which means if they have not already started
> this, it ain't gonna happen in the "near future" for any conventional interpretation of
> "near". Otherwise, the device will come with a programming manual that describes how to
> talk to it. The fact that the communication to the device takes place over USB is
> completely irrelevant to you, the application programmer. And if it doesn't come with a
> device driver, they have not delivered a "product", but what we traditionally call a
> "paperweight".
>
> I know a few device driver programmers who are USB experts (I don't count myself among
> them) if you need assistance.
> joe
>
> On Wed, 31 Mar 2010 10:10:01 -0500, TomChapman <TomChapman12(a)gmail.com> wrote:
>
> >Many of my programs communicate with equipment using serial COM port
> >interfaces or network TCP interfaces.
> >
> >In the near future I will need to communicate with a new piece of
> >equipment that uses a USB interface. I don't know any specifics yet. I
> >don't know if there is a SDK for this piece of equipment.
> >
> >How do I communicate with USB? Is there a library or a book anyone can
> >recommend? Any comments would be appreciated.
> Joseph M. Newcomer [MVP]
> email: newcomer(a)flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm
> .
>
From: RFOG on
Sigh!

Joseph: the MFR offers the DLL that interact with the driver that
interact with the hardware. Then the MFR ofers a DLL that does the job
(appart from a driver, of course).

Do you want a sample? Here:
http://www.heber.co.uk/downloads.php?page=downloads_xspin

The board only has a bootloader that waits the windows/linux driver to
inject the firmware.


On Fri, 02 Apr 2010 12:47:12 -0500, Joseph M. Newcomer
<newcomer(a)flounder.com> wrote:

>It is a common misconcpetion that a simple DLL will supply the necessary connectivity to a
>USB device. This is not true. Only a device driver (kernel or user mode) will work, and
>these are complex beasts that require extremely careful design and implementation.
>
>No "patches" to Windows are required. and "a DLL" won't do the job!
> joe
>
>On Wed, 31 Mar 2010 21:32:30 +0300, RFOG <no(a)mail.com> wrote:
>
>>Sometimes those devices use a virtual COM, that is, a driver that converts
>>a USB port to a RS232 port and then it is used as one normal serial port.
>>Others that uses direct USB stuff, as David has said, normally offers a
>>DLL or a more easy way to work with. However each mfr. uses his own
>>approach. Some offers a DLL, some patches normal windows
>>CreateFile/ReadFile/WriteFile. But most common is use a DLL or a
>>USB-to-Serial driver.
>>
>>On Wed, 31 Mar 2010 18:10:01 +0300, TomChapman <TomChapman12(a)gmail.com>
>>wrote:
>>
>>> Many of my programs communicate with equipment using serial COM port
>>> interfaces or network TCP interfaces.
>>>
>>> In the near future I will need to communicate with a new piece of
>>> equipment that uses a USB interface. I don't know any specifics yet. I
>>> don't know if there is a SDK for this piece of equipment.
>>>
>>> How do I communicate with USB? Is there a library or a book anyone can
>>> recommend? Any comments would be appreciated.
>Joseph M. Newcomer [MVP]
>email: newcomer(a)flounder.com
>Web: http://www.flounder.com
>MVP Tips: http://www.flounder.com/mvp_tips.htm
ÿþM
From: RFOG on
And the company I work for offers some devices that uses the
USB-to-Serial from Windows Update (FTDI chips) and then we give a DLL
to the customers to ease the communication protocol.

On Fri, 02 Apr 2010 21:13:21 +0200, RFOG <no(a)mail.com> wrote:

>Sigh!
>
>Joseph: the MFR offers the DLL that interact with the driver that
>interact with the hardware. Then the MFR ofers a DLL that does the job
>(appart from a driver, of course).
>
>Do you want a sample? Here:
>http://www.heber.co.uk/downloads.php?page=downloads_xspin
>
>The board only has a bootloader that waits the windows/linux driver to
>inject the firmware.
>
>
>On Fri, 02 Apr 2010 12:47:12 -0500, Joseph M. Newcomer
><newcomer(a)flounder.com> wrote:
>
>>It is a common misconcpetion that a simple DLL will supply the necessary connectivity to a
>>USB device. This is not true. Only a device driver (kernel or user mode) will work, and
>>these are complex beasts that require extremely careful design and implementation.
>>
>>No "patches" to Windows are required. and "a DLL" won't do the job!
>> joe
>>
>>On Wed, 31 Mar 2010 21:32:30 +0300, RFOG <no(a)mail.com> wrote:
>>
>>>Sometimes those devices use a virtual COM, that is, a driver that converts
>>>a USB port to a RS232 port and then it is used as one normal serial port.
>>>Others that uses direct USB stuff, as David has said, normally offers a
>>>DLL or a more easy way to work with. However each mfr. uses his own
>>>approach. Some offers a DLL, some patches normal windows
>>>CreateFile/ReadFile/WriteFile. But most common is use a DLL or a
>>>USB-to-Serial driver.
>>>
>>>On Wed, 31 Mar 2010 18:10:01 +0300, TomChapman <TomChapman12(a)gmail.com>
>>>wrote:
>>>
>>>> Many of my programs communicate with equipment using serial COM port
>>>> interfaces or network TCP interfaces.
>>>>
>>>> In the near future I will need to communicate with a new piece of
>>>> equipment that uses a USB interface. I don't know any specifics yet. I
>>>> don't know if there is a SDK for this piece of equipment.
>>>>
>>>> How do I communicate with USB? Is there a library or a book anyone can
>>>> recommend? Any comments would be appreciated.
>>Joseph M. Newcomer [MVP]
>>email: newcomer(a)flounder.com
>>Web: http://www.flounder.com
>>MVP Tips: http://www.flounder.com/mvp_tips.htm
>ÿþM
ÿþM
From: DanB on
TomChapman wrote:
> Many of my programs communicate with equipment using serial COM port
> interfaces or network TCP interfaces.
>
> In the near future I will need to communicate with a new piece of
> equipment that uses a USB interface. I don't know any specifics yet. I
> don't know if there is a SDK for this piece of equipment.
>
> How do I communicate with USB? Is there a library or a book anyone can
> recommend? Any comments would be appreciated.

I use the FTDI device.
<http://lakeweb.net/MSP430>

I do believe you can set the EEPORM in the device so it looks like your
own when plugged in. But I haven't gone there yet so can't comment further.

There is also an 8051 based device that is very popular. TI uses it on
their development boards. I think it comes with an SDK with most of the
stuff done.

With the FTDI device you get the DLLs for the box side and don't have to
reinvent that wheel.

The USB market has come a long way in the last few years. Everyone seems
to be building the interface into their products.

<http://focus.ti.com/mcu/docs/mcuorphan.tsp?contentId=65684>

There is no good reason to write your own drivers anymore.

Best, Dan.
From: Joseph M. Newcomer on
It is not uncommon that a manufacture will smooth over the ugliness of the low-level API
interface by providing a library (most commonly as a DLL), but the key here is that the
DLL is not the device driver; it is an INTERFACE to the device driver!

In my driver course, I describe to my students how to trade off the coding decisions
between what has to go into the driver and what can move up to the DLL, and how the
engineering decisions are made as to where code should go.

But without the actual device driver, the DLL cannot do anything. Unless the device is
designed to be HID-compliant, in which case the DLL disguises the ugliness of the
interface details (for example, the use of DeviceIoControl is reasonably ugly to explain
to application programmers. Note that the serial port driver does NOT implment APIs such
as GetCommState, SetCommTimeouts, etc.; these are APIs that appear in a DLL (I forget
which one) that generate reasonably ugly DeviceIoControl calls to the actual device
driver, which has to support something like 44 different IOCTL codes for DeviceIoControl.
joe

On Fri, 02 Apr 2010 21:13:21 +0200, RFOG <no(a)mail.com> wrote:

>Sigh!
>
>Joseph: the MFR offers the DLL that interact with the driver that
>interact with the hardware. Then the MFR ofers a DLL that does the job
>(appart from a driver, of course).
>
>Do you want a sample? Here:
>http://www.heber.co.uk/downloads.php?page=downloads_xspin
****
It sounds like this is a HID-compliant device because it has to do with gaming. Or this
is a library for interfacing to generic HID-compliant devices. In this case, Microsoft
has written the device driver, and you are using a library that intefaces to it.
joe
****
>
>The board only has a bootloader that waits the windows/linux driver to
>inject the firmware.
>
>
>On Fri, 02 Apr 2010 12:47:12 -0500, Joseph M. Newcomer
><newcomer(a)flounder.com> wrote:
>
>>It is a common misconcpetion that a simple DLL will supply the necessary connectivity to a
>>USB device. This is not true. Only a device driver (kernel or user mode) will work, and
>>these are complex beasts that require extremely careful design and implementation.
>>
>>No "patches" to Windows are required. and "a DLL" won't do the job!
>> joe
>>
>>On Wed, 31 Mar 2010 21:32:30 +0300, RFOG <no(a)mail.com> wrote:
>>
>>>Sometimes those devices use a virtual COM, that is, a driver that converts
>>>a USB port to a RS232 port and then it is used as one normal serial port.
>>>Others that uses direct USB stuff, as David has said, normally offers a
>>>DLL or a more easy way to work with. However each mfr. uses his own
>>>approach. Some offers a DLL, some patches normal windows
>>>CreateFile/ReadFile/WriteFile. But most common is use a DLL or a
>>>USB-to-Serial driver.
>>>
>>>On Wed, 31 Mar 2010 18:10:01 +0300, TomChapman <TomChapman12(a)gmail.com>
>>>wrote:
>>>
>>>> Many of my programs communicate with equipment using serial COM port
>>>> interfaces or network TCP interfaces.
>>>>
>>>> In the near future I will need to communicate with a new piece of
>>>> equipment that uses a USB interface. I don't know any specifics yet. I
>>>> don't know if there is a SDK for this piece of equipment.
>>>>
>>>> How do I communicate with USB? Is there a library or a book anyone can
>>>> recommend? Any comments would be appreciated.
>>Joseph M. Newcomer [MVP]
>>email: newcomer(a)flounder.com
>>Web: http://www.flounder.com
>>MVP Tips: http://www.flounder.com/mvp_tips.htm
>��M
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm