Suppose we have a computer mouse , now when we connect it to a computer then computer understands it is a mouse which is been connected to it. Same thing happens for keyboard and many other devices. As per my understanding, the mouse has a microcontroller and a TTL serial converter which is programmed a certain way that enable computer's default mouse driver to understand the instructions coming from the connected device.
Let me to talk about one of my projects where I build a device driver for my own device. Like arduino send serial instructions to a port say COM3 and the driver which is a java program reads those instructions and performs accordingly.
As we all know that the arduino library provides support for Mouse and keyboard which works fine. Mouse operations are performed without a custom driver.
Now what I want is when arduino connects to a computer it gets detected as a Joystick or as a pendrive or something like that.
I go through different header files of mouse and keyboard which are present in arduino library but those are very complex and without proper documentation hard to understand.
Can you tell me where I could find study materiel regarding the existing library? Arduino website provides documentations only on different methods not on how it works.
Or if I think of building my own library then how I should start?
One more thing where I can find the information regarding the protocols that a conventional device like mouse, keyboard, pendrive, CD-ROM follows during communication (like the code or the algorithm that is burn into the microcontroller of the device) ?
I know it is a out of the box question but still if you help me, I will be grateful to you.