Maker Pro
Maker Pro

How is a mouse detected as a mouse?

mftetsudou

Apr 26, 2015
1
Joined
Apr 26, 2015
Messages
1
Sorry if this question is too basic. I'm a beginner in the field of electronics.

I was building this 5-minute yoke (since I'm into flight simulators) and I started wondering why a joystick is detected as a joystick and a mouse is detected as a mouse. I actually wanted the mouse to be detected as a joystick by the computer, but I had no idea how.

So, how is a mouse detected as a mouse and a joystick as a joystick?

I'm using Mac OS X 10.10.
 

Tha fios agaibh

Aug 11, 2014
2,252
Joined
Aug 11, 2014
Messages
2,252
Usb devices are controlled by a computer file called a driver. It has the .drv file extension. It basically tells the computer how to interpret the input signal.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,743
Joined
Nov 17, 2011
Messages
13,743
Each USB device has a vendor ID, designating the manufacturer of the device, and a device ID, designating the type of device.
When you plug a USB device into the host port, the device will identify itself to the host using these IDs.
In addition there are a few descriptors that can be read by the host, e.g. device descriptor, configuration descriptor, interface descriptor etc.

this information allows the host to select the appropriate device driver to support the USB device.

There are standardized device classes which will allow a host to control a USB device with default drivers (e.g. for a mouse, mass storage etc) but will not enable special features a dedicated driver (supplied by the USB device's manufacturer) may offer.

In your case, a mouse and a joystick (as well as a keyboard) belong to the class Human Interfcae Device (HID) and are distinguished by the host using the mouse's or joystick's unique IDs. Without modification of the firmware of these devices it will not be easy to make the one appear as the other and vice versa. Some tweaking may be possible by manipulating the device drivers, but that is way beyond my experience.
 
Top