Transferred from: http://blog.csdn.net/jimmy_1986/article/details/5838297
Embedded Linux USB belongs to all the drivers of a very complex subsystem, want to completely conquer her, at least a few months, do not believe? That's not what you did.
I have done 2 years of embedded drive development, USB accounted for more than half time. During a lot of detours, the following will be my blood lessons summed up, for to engage and are engaged in the comrades to do a little bit of contribution it:)
First, literacy;
To do is read the USB Spec (oh, in fact, a lot of articles, books and materials really have a level or original good, like food is often processed to change the taste, before if not contact before you can first look at the Chinese, probably first an impression), this work is actually very complex very boring part. Look at the spec at the same time you can go to the Internet to browse the relevant knowledge of USB development, this stage is literacy, not to seek diligence. At least you need to know the four types of USB transmission, you need to know the USB from the power to start a few states, you need to know what USB devices are, and so on.
The second step is to peep the whole picture;
How does a USB device work? In fact, the USB subsystem is a sub-level work, they cooperate with tacit understanding, do their own part of the matter, everything to the overall situation. USB drive can be divided into USB device driver, USB controller driver, hub driver, bus driver and so on. I suggest you go down the main line driven by the device.
Before you really start analyzing USB driver code, you need to understand the Linux module mechanism, the Linux-powered platform bus architecture, and so on. Once a module has been loaded, from the driver point of view, the device is actually driven from probe onwards. You should know that. You need to know why USB can plug and Play, software friends should know thread this thing, and she has a relationship. One of the most important characters in the USB system it's time to play, Urb. Everything has to be done around her. The pipe paved the road for her, and the data was carried by her. USB device driver's job is to prepare this urb after her mission is basically completed, then she gave Urb to whom? This is the previously mentioned USB controller driver, host.
As for host, there are a lot of money on the market now, and if your boss gives you the most mature image of EHCI, you're lucky. This basic does not need you to write, as long as a little modification, to register her on the bus can. If you are unfortunate enough to use a host like MUSB, you are miserable and you have suffered.
The third step, excellence;
This time the driver you have also transferred, perhaps it has already run up, perhaps did not run up. Perhaps you begin impetuous, to this time what also past a month, if have not produced results inevitably impatient. Well, if that's the case, what should you do? Look at spec again, look at the whole driving process and repeat what you've done before. This time you look absolutely different from before. What you have to learn at this time is, persistence, endurance ... and so on.
Finally, let me introduce you to the information I think is good, you can refer to. Like the Fudan a buddy wrote Linux that Thing (people too much trouble can come to my here download Linux Those things I am a U disk. pdf), LDD3, the best information is the source code.
Turn: USB driver Development method under embedded Linux--read less detours "turn"