Windows likes drivers for the CDC examples

1,627 views
Skip to first unread message

robint91

unread,
Dec 26, 2010, 11:08:05 AM12/26/10
to LUFA (Formerly MyUSB) Support
Dear,

I have a small problem. Windows isn't that happy because it can't find
any driver for the lufa CDC examples.
I have windows 7 64bit pro, and the hardware is an atusbkey.
The HID and mass storage examples work. I used the last lufa "build".
Is there any solution?


Thanks

Robin Theunis

Dean Camera

unread,
Dec 26, 2010, 11:33:01 AM12/26/10
to LUFA (Formerly MyUSB) Support
Robin,

Windows contains inbuilt drivers for CDC (Virtual Serial) devices, but
by default won't use them - you need to "force" Windows into using the
inbuilt drivers. To do that, you need to use the .INF files located in
the demos, bootloaders and projects that contain them.

First plug in your device, and either let Windows search (and fail)
for a driver, or cancel the search early. Open Device Manager from the
control panel, select the LUFA CDC device with the driver error
indication on it, and choose the option in the properties window to
update the driver. From there, use the manual driver location option
and point it at the .INF file. That should cause Windows to find the
correct inbuilt CDC driver and install it for the device.

Cheers!
- Dean

Robin Theunis

unread,
Dec 27, 2010, 4:33:44 AM12/27/10
to myusb-sup...@googlegroups.com
Hi Dean,

Yes that works okay! But I have still problems with the
VirtualSerialMouse demo. The mouse works but not the serialport.

Is there a way to automate it, like with an installer for windows?

Thanks

Robin

2010/12/26 Dean Camera <abcmi...@gmail.com>:

> --
> You received this message because you are subscribed to the Google Groups "LUFA (Formerly MyUSB) Support" group.
> To post to this group, send email to myusb-sup...@googlegroups.com.
> To unsubscribe from this group, send email to myusb-support-l...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/myusb-support-list?hl=en.
>
>

Dean Camera

unread,
Dec 31, 2010, 10:11:42 AM12/31/10
to LUFA (Formerly MyUSB) Support
Robin,

Did you try to install the .INF file that comes with that demo? It is
slightly different to the standard LUFA CDC (Virtual Serial) driver,
as it has to bind to a specific interface of the device, rather than
the device as a whole (due to the multiple drivers used for the Mouse
and the Virtual Serial portions). The demo-specific driver INF should
work correctly.

As for an automation, I'm not aware of a way to do it natively - you'd
need to use something like the "Windows Driver Installer" tool from
here:

http://www.pjrc.com/teensy/usb_serial.html

Which, when run, will go through all devices in the PC and install the
CDC driver if it uses the correct Class/Subclass/Protocol. Use at your
own risk, and one unfortunate side effect of the program is that the
Virtual Serial devices will appear in the Device Manager with PJRC
branding, and not your own (or LUFA).

Cheers!
- Dean

On Dec 27, 10:33 am, Robin Theunis <robin...@gmail.com> wrote:
> Hi Dean,
>
> Yes that works okay! But I have still problems with the
> VirtualSerialMouse demo. The mouse works but not the serialport.
>
> Is there a way to automate it, like with an installer for windows?
>
> Thanks
>
> Robin
>
> 2010/12/26 Dean Camera <abcminiu...@gmail.com>:

Nathaly Arraiz Matute

unread,
Jul 16, 2013, 11:05:11 PM7/16/13
to lufa-s...@googlegroups.com, LUFA (Formerly MyUSB) Support
Hi Dean,
  I am also using the CDC demo as a starting point to my own project. For the final outcome I was hoping to get a script to automatically install this driver. Would you be able to help me with this, or point me to a good resource where I can learn to write such a script? 
I know this is a bit off topic, but would appreciate any advice.
Thanks,
~nathaly

Paul Stoffregen

unread,
Jul 17, 2013, 8:40:38 AM7/17/13
to lufa-s...@googlegroups.com
On 07/16/2013 08:05 PM, Nathaly Arraiz Matute wrote:
Hi Dean,
  I am also using the CDC demo as a starting point to my own project. For the final outcome I was hoping to get a script to automatically install this driver. Would you be able to help me with this, or point me to a good resource where I can learn to write such a script?

Perhaps the Nullsoft installer?

Google for "Nullsoft Scriptable Install System".


--
You received this message because you are subscribed to the Google Groups "LUFA Library Support List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lufa-support...@googlegroups.com.
To post to this group, send email to lufa-s...@googlegroups.com.
Visit this group at http://groups.google.com/group/lufa-support.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Dean Camera

unread,
Jul 17, 2013, 4:03:53 PM7/17/13
to lufa-s...@googlegroups.com
The secret sauce to make this possible would be to add:

[DefaultInstall]
CopyINF="LUFA VirtualSerial.inf"

To the driver INF file (fix up the filename to reference the name of the driver INF itself) which will allow for legacy right-click->Install method of installation before plugging in your device for the first time. You could also manually install it via a rundll32 call. However, I haven't done this in the LUFA examples as it then makes the INF filename significant, which is nasty -- and installation via this method is actually deprecated. Why Microsoft didn't add a nice way to silently do this without a helper application is beyond me.

Cheers!
- Dean
--

Hans Schou

unread,
Jul 21, 2013, 5:59:37 PM7/21/13
to lufa-support, LUFA (Formerly MyUSB) Support
2013/7/17 Nathaly Arraiz Matute <nathal...@gmail.com>

Hi Dean,
  I am also using the CDC demo as a starting point to my own project. For the final outcome I was hoping to get a script to automatically install this driver. Would you be able to help me with this, or point me to a good resource where I can learn to write such a script? 

As CDC is rather annoying on Windows there is one thing you can do: use a USB class which does not require a driver, and in that way make the installation less complicated.

These classes are Mass storage, keyboard, mouse and joystick. Depending on your project it might not be suitable to use these, so explain your needs and someone might come up with an idea. If your device is similar to a modem you probably would stick with CDC.

One project in LUFA which uses CDC is SerialToLCD. By looking at Bootloaders/MassStorage/Lib/VirtualFAT.c it should be possible to transform that LCD demo to use mass storage instead of CDC. 

If you need to read data from your device it can also be done with mass storage, as you dump you data when a certain block number is requested in the FAT system.

From the command line you can write data like this: 
  ECHO "Hello" > LCD.DAT
and read data like this
  TYPE LCD.DAT

So it seems like one can access the LCD through a file but in reality it is a virtual file and it activating the LCD commands rather than just storing the data.

There is one thing I have not figured out and that is how to limit input and output in VirtualFAT.c to a block with less than 512 bytes. There is a call to Endpoint_Write_Stream_LE() and maybe the amount should just be limited to the actual number of bytes. Maybe Dean can answer that.

One easy thing to add when you have started using MassStorage is to add extra information. Files like:
  AUTORUN.INI
  README.TXT
  INDEX.HTM
  LUFA-SER.INF
  FIRMWARE.HEX
  BOOTLOAD.HEX
  EEPROM.EPP
Keep file size under 512 bytes to make it simple.

/hans

Hans Schou

unread,
Jul 21, 2013, 6:23:52 PM7/21/13
to lufa-support

Dean Camera

unread,
Jul 22, 2013, 1:31:13 PM7/22/13
to lufa-s...@googlegroups.com
Limiting to less than a single block isn't feasible; the host expects the media to be addressable in 512 byte chunks, and trying to work out partial offsets within a block is a recipie for disaster. Much better to set up the filesystem layout manually in the code with each virtual file being an integer number of blocks apart.

I think this is the approach of the PhatIO (http://www.phatio.com/) project, which uses LUFA with a different virtualized FAT filesystem implementation.

Cheers!
- Dean

Hans Schou

unread,
Jul 23, 2013, 1:54:57 AM7/23/13
to lufa-support
2013/7/22 Dean Camera <de...@fourwalledcubicle.com>
Limiting to less than a single block isn't feasible;

My question was how I could see that I got less bytes than a block. I guess it is in the BytesProcessed in Endpoint_Read_Stream_LE()


Much better to set up the filesystem layout manually in the code with each virtual file being an integer number of blocks apart.

Yes.
 

I think this is the approach of the PhatIO (http://www.phatio.com/) project, which uses LUFA with a different virtualized FAT filesystem implementation.

That is exactly what I meant. It is really a good approach.

/hans

Bob Paddock

unread,
Jul 23, 2013, 8:56:59 AM7/23/13
to lufa-s...@googlegroups.com
On Tue, Jul 16, 2013 at 11:05 PM, Nathaly Arraiz Matute
<nathal...@gmail.com> wrote:
> Hi Dean,
> I am also using the CDC demo as a starting point to my own project. For
> the final outcome I was hoping to get a script to automatically install this
> driver. Would you be able to help me with this, or point me to a good
> resource where I can learn to write such a script?

Alas it is not as easy as a simple script, however libWDI or libUSBK
should get you where you want to end up.
In the case of a HID take a look at HIDAPI.

[Dean please consider adding these links to the FAQ.]

https://github.com/pbatard/libwdi libWDI

libwdi: Windows Driver Installer library for USB devices
http://libwdi.akeo.ie

Providing developers with an easy way to install drivers on Windows system

Main features:
- Automated inf creation, using the name reported by the USB device
- Automated catalog file creation and signing, using autogenerated certificate
- Automated driver files extraction, for both 32 and 64 bit platforms
- Automated driver installation, including UAC elevation where necessary
- Single library embedding all the required files, that can be statically or
dynamically linked to your application in order to provide driver installation
facilities at runtime, on any Windows platform (Windows 2000 to Windows 7,
including both 32 and 64 bit versions of the OS, from the same binary)

Additional features:
- Embedding of WinUSB, libusb0.sys or libusbK.sys (from libusb-win32)
or your own
USB drivers (eg. WHQL)
- Full locale support with UTF-8 API strings and UTF-16 autogenerated inf files
- Resolution of USB Vendor IDs, based on the data maintained by Stephen J. Gowdy
at http://www.linux-usb.org/usb.ids
- Fully Open Source (LGPL v3), with many example applications
- Supports MinGW32, MinGW-w64, cygwin (with -mno-cygwin), Visual Studio, WDK

http://libusbk.sourceforge.net/UsbK3/index.html libUSBK

libusbK is a complete driver/library solution for vendor class usb
device interfaces. If you are a usb developers or usb device
manufacturer seeking a driver solution for a new USB widget then
libusbK could be for you.libusbK encompasses a 100% WinUSB compatible
api/funtion set. All WinUSB power/pipe polices are fully supported by
the libusbK driver. In Addition, libusbK has full support for
isochronous endpoints and an extensive set of additional modules to
simplify development.

https://github.com/signal11/hidapi HIDAPI:

A Simple library for communicating with USB and Bluetooth HID devices
on Linux, Mac, and Windows.

Dean Camera

unread,
Jul 25, 2013, 12:43:17 PM7/25/13
to lufa-s...@googlegroups.com
> My question was how I could see that I got less bytes than a block. I guess it is in the BytesProcessed in Endpoint_Read_Stream_LE()

Mass storage devices *always* read and write an integer number of blocks - the host will perform a read-modify-write if it needs to preserve part of the block. You would have to examine the file entry in the FAT table to determine the real file size.

- Dean

Reply all
Reply to author
Forward
0 new messages