Does anybody ever succeed writing USB device from DOS ?

Thx for a reply

Dani AI

Generated

Short answer: yes — but only with the right approach. DOS has no native USB host stack, so success depends on whether you mean "write the device firmware" or "write DOS host-side USB code." As asked, both are possible, but the practical path is usually to make the device present itself as a USB class the PC/BIOS already understands (so DOS never needs to speak USB).

If the goal is to make a peripheral usable from plain DOS with minimal host work, aim for a class with BIOS legacy support: HID (keyboard/mouse) or Mass Storage. HID keyboards often get legacy-emulated keystrokes (INT 16h) and storage devices can appear as BIOS drives (INT 13h) on many machines. For a serial-style link, do not rely on CDC/VCP — DOS lacks USB drivers — instead provide a real RS-232 interface or a hardware bridge that exposes genuine UART signals to COM1/COM2.

For firmware work: develop and debug on a modern OS where USB sniffers and enumeration tools are available, then trim the stack to only the descriptors and endpoints needed for the DOS-compatible class. As recommended, read the USB specification for descriptor rules; and as found, vendor stacks speed prototyping but custom, lean implementations are often more reliable and smaller for embedded targets.

Writing a full DOS USB host driver is a large project (PCI access, UHCI/OHCI/EHCI/xHCI registers, enumeration, transfer scheduling). Practical workflow: choose a DOS-friendly class, prototype on Windows/Linux, verify target-PC BIOS legacy behavior, add a hardware fallback (RS-232) if needed, and use a USB hardware analyzer or OS sniffer to debug enumeration and descriptor problems.

Recommended Answers

All 4 Replies

Personally, I haven't. But I am interested in writing USB-programmes as well. A very good place to start is usb.org. It is the official website for the USB-interface and provides many useful information and documentation.

If you have you first successful code, please let me know.

Regards Simon

What kind of device do you have?
Mass storage, CDC, HID or something else...

I was just working with my normal computer and tryin to access my keyboard. Unfortunately I don't have time to realize that project even though it still interests me.

When using one of these small ATMEL-processors, then you can find a lib for it. Maybe you can sort some information out of it. (http://www.atmel.com/)

I worked with Microchip USB controllers and from my own experience better to write your own code then use their libraries. More reliable, less memory consumption (at least concerning USB), because their libraries AS IS. But time consuming that’s right.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.