Connect with us

How is a mouse detected as a mouse?

Discussion in 'Microcontrollers, Programming and IoT' started by mftetsudou, Apr 26, 2015.

Scroll to continue with content
  1. mftetsudou


    Apr 26, 2015
    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.
  2. Tha fios agaibh

    Tha fios agaibh

    Aug 11, 2014
    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.
  3. Harald Kapp

    Harald Kapp Moderator Moderator

    Nov 17, 2011
    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.
    hevans1944, davenn and Ian like this.
  4. davenn

    davenn Moderator

    Sep 5, 2009
    great info Harald
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day