Skip to content
Tech News
← Back to articles

USB for Software Developers: An introduction to writing userspace USB drivers

read original get USB Development Kit → more articles
Why This Matters

This article demystifies USB driver development, showing that writing userspace USB drivers is accessible even for those without extensive hardware experience. It emphasizes that understanding and working with USB can be approachable, empowering developers to create custom drivers and better integrate USB devices into their projects. This knowledge is crucial for expanding device compatibility and fostering innovation in hardware-software integration.

Key Takeaways

Introductionh1

Say you’re being handed a USB device and told to write a driver for it. Seems like a daunting task at first, right? Writing drivers means you have to write Kernel code, and writing Kernel code is hard, low level, hard to debug and so on.

None of this is actually true though . Writing a driver for a USB device is actually not much more difficult than writing an application that uses Sockets.

This post aims to be a high level introduction to using USB for people who may not have worked with Hardware too much yet and just want to use the technology. There are amazing resources out there such as USB in a NutShell that go into a lot of detail about how USB precisely works (check them out if you want more information), they are however not really approachable for somebody who has never worked with USB before and doesn’t have a certain background in Hardware. You don’t need to be an Embedded Systems Engineer to use USB the same way you don’t need to be a Network Specialist to use Sockets and the Internet.

The USB Deviceh1

The device we’ll be using an Android phone in Bootloader mode. The reason for this is that

It’s a device you can easily get your hands on

The protocol it uses is well documented and incredibly simple

Drivers for it are generally not pre-installed on your system so the OS will not interfere with our experiments

Getting the phone into Bootloader mode is different for every device, but usually involves holding down a combination of buttons while the phone is starting up. In my case it’s holding the volume down button while powering on the phone

... continue reading