Writing a Driver

How would I go about writing driver software for a mouse? 


I figure it would be in C , I know pretty much nothing about coding, were do I start 

Try this.

A mouse is a HID and there are generic drivers for keyboards and mice because they use a common protocol subset. If your mouse has more features than this subset you have to write a driver for it. For Linux there is a book online for free http://www.xml.com/ldd/chapter/book/ and you can of cause look at all other drivers for which linux has support. So whenever you don't know what to do you can take a look at those.

Most of the time you need information about how a device works. If you're lucky you can find a document online or a company will give you documents on request. Most of the time though you're on your own and you have to sniff the connection between the device and your computer. There is Wireshark for all kinds of sniffing. In the case of porting a windows driver for a USB device to linux, you might want to install a VM with Windows on it, forward the USB device and use wireshark to sniff what's happening.