Live data from Hacker News

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

werwolv.net

51–57 of 57 posts

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

#52

Perfect timing. I'm expecting to get my hands on a MOTU MIDI Express XT from my local Guitar Center within the next couple days (I paid for it when it arrived there a couple weeks ago, but they have a mandatory waiting period on used equipment to make sure it ain't stolen), which unfortunately uses some weird proprietary protocol instead of class-compliant MIDI-over-USB — so any use over USB from my PCs (nearly all o…

I have had significant success using Claude to reverse engineer hardware

Yes Claude is impressive in HW-Development. It knows all those magic numbers and how chips work. i even use it to do development for Power delivery Systems.

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

#55
post #52

Earlier quoted context omitted.

I have had significant success using Claude to reverse engineer hardware

Yes Claude is impressive in HW-Development. It knows all those magic numbers and how chips work. i even use it to do development for Power delivery Systems.

hope nothing goes wrong with it

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

#56
post #44

Earlier quoted context omitted.

Why would anybody think more words more better? int main() {

The trailing return type pattern was added to the standard, IIRC, to make it easier for templated functions to have return types that depend on the types of the arguments, such as in this example: template auto multiply(A a, B b) -> decltype(a * b) { return a * b; } Its easier for the compiler to parse everything if `decltype(a * b) occurs _after_ the definition of `a` and `b`. Once this pattern was added and people…

Yes, in that case I completely agree. Using it everywhere is a mistake IMHO. I know there might be a stylistic reason for using it everywhere, but I believe less code is better, unless more code makes it easier to understand.

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

#57
post #8
post #5

Earlier quoted context omitted.

Things which are relatively standard tend to get good generic support: Ethernet devices will generally be USB/CDC/ECM or RNDIS, for example. That may Just Work (tm) if it has the right descriptors. The userland approach is much more useful for weird or custom devices. In particular, on Windows you can do one of these user space "drivers" without having to bother with driver signing, and if you use libusb it will be p…

DFU - great example. If you have a USB device that has a DFU class that needs a custom driver, can dfu-util and the like hook into these userspace drivers? Or do you also need to maintain the application part?

That's two different problems really. You mostly use libusb when you own the application part too, think of an utility to burn firmware into phones or something like. You can also make a userspace driver for some device classes, like input. If you combine the two, you can let the rest of the system use the device without knowing what it's driver is.
Post reply on HN