Megan K
Megan K

Reputation: 35

Implementation of USB device driver on my own OS based in Linux

I’m on process of developing my own Operating System based in Linux.

This week we’re aiming to implement very simple USB device driver , which is quite hard to get basic algorithm .

However commonly it’s hard to find out some sources aside from commercial linux system. And I want to get some advice about this .

Plus, I do all these stuffs on Ubuntu , using QEMU emulator. I’ve done simple file system and hard disk device driver so far.

Help me out how to implement USB device driver with very sime ideas. Thank you !! :)

Upvotes: 0

Views: 569

Answers (1)

fysnet
fysnet

Reputation: 449

Implementing USB is quite the task. First you must have a working PCI(e) enumerator or other form of finding the USB controller. You then must find out which of the four most common controller types it happens to be. Each controller type is completely different from the previous and must contain its own driver. You also need a standard USB interface that is independent of the controller type.

Taking on the USB is quite the task, but in my opinion a very interesting and enjoyable task. Enjoyable enough, that I even wrote a book about how to do it. It explains how to find the controller(s) via the PCI(e) bus, how to setup this bus, how to detect the type of USB controller--UHCI, OHCI, EHCI, or xHCI--and how to send and receive data packets to/from attached devices. This book was written exactly for the purpose of those of us creating our own operating systems and adding USB support to them. The fact that you are basing your OS on Linux should not matter since the book does not rely upon any existing OS to accomplish this task, other than the example programs relying on memory allocation, which is easily modified for your developing platform.

Might I say that if you do take on this task, it will be a difficult task, but it will be an enjoyable task. In my opinion, the USB is the most enjoyable part of this hobby of ours.

Upvotes: 1

Related Questions