Is there a way to get an operating system to report the mouse location to a USB device - operating-system

I have a product that has a mouse interface. I need the operating system to report the absolute position of the mouse pointer to another USB device.
Is there an HID descriptor that I can add to gather mouse info?
Thanks

I think you need to write a special driver and service than can do that. It is not easy task.

Related

"Emulating" HID Gamepad

Since we are still struggling with sending and receiving bluetooth data, we want to try a different way, ignoring bluetooth for now.
Is it possible to write a software, which Windows or Linux is recognizing as a Hardware Gamepad for simulating (so we only need to change the input of that tool to bluetooth input later)?
And if it is possible, what do I need to know for achieving that? Thank you!
(We are using C/C++)

Can I store a program on my mouse that runs when i connect it?

So various people around my house have been stealing my mouse and I was wondering if I could store a program on the mouse which runs whenever it's plugged in, asking you for a password. I know you can run a program stored on a computer when a device is inserted into a USB slot but that means I can't stop people using my mouse if the specific laptop he's using hasn't got the program installed.
Also, if this was possible, what language would use? I would like it to work on windows, linux and OSX to cover all bases.
Thanks for any help!

Mouse Detect, OS Boot

I was just wondering how the mouse, keyboard works during the boot process. Let us say that I have a USB mouse and a USB keyboard. When I switch on my computer, POST is done just to check whether all the hardware connected to my system are working. But to get a USB hardware working, we need to have a USB driver which ultimately is a process. But if OS is not loaded yet(I mean init and swapper processes), how this process comes into existence? One thing striking my mind is BIOS. But I think, BIOS can't identify the different drivers needed to detect different mouse, keyboards. Please help.
The BIOS is able to enumerate and control a certain subset of USB devices. In particular, mice and keyboards belong to a common class of devices (Human Interface Devices, HID) that are have a common, defined interface and which is fairly to drive. So, the BIOS just has drivers for that class of devices baked in.
Modern BIOSes emulate the PS/2 ports 0x60 and 0x64 using SMM/SMI with a feature often called "USB Legacy Support" (see the EHCI specification for more info.)
When the OS itself loads and initializes the USB controller there is a controller ownership transition from BIOS-owned to OS-owned.

Does any interrupt occur when a usb device is connected?

I am working on USB HIDs on linux platform. Keyboards, mouse etc., are examples of Human Interface Devices. Whenever a HID is inserted to a system, at first device enumeration occurs. Then an entry in the form of hidraw appears in the /dev directory.
In linux, "usbhid and hid" are the modules which are called when an HID device is inserted. When I disabled these modules (using rmmod and system restart), the devices were not enumerated and no hidraw entry appeared on /dev(as expected).
Now my question is there any way to know if any USB HID device is connected to a system with the above two modules being disabled i.e does any interrupt or signal generate upon hardware insertion.
I am planning to execute some code when such signal or interrupt occurs(in C). Any kind of help is appreciated.
Thanks,
Insertion of the device is detected through the voltage level changes occuring on the D+ and the D- lines. I do not think that insertion of USB device generates any interrupt. The voltage level changes are read by the hub(root or any hub further down on the line) and according reported to the core.
The USB core driver would be notified about the same. So may be you can write a user-space driver which targets a specific device (using Vendor and Product ID) and through this you can carry out your functionality.
If you are doing this in user mode, you get get a notification using udev (which use netlink internally).
You can match a device using the vendorId and productId field in the rulefile.
SUBSYSTEMS=="usb", ATTRS{idVendor}=="abcd", ATTRS{idProduct}=="1234"

Controling Pc Mouse from Gryoscope/Accelormeter

I have build an IMU consisting of an Accelerometer and Gyroscope that can provide 6DOF motion output results to pc. I use a serial COM port over USB interface to get data on pc and i can see the data through Hyper terminal.
Now what i want to do is control my mouse pointer with that data for demonstration purposes. I initially looked at GlovePIe application but it doesn't support serial com ports. So it would be great if anybody could advice or direct me to a possible solution.
I am doing something similar, controlling pc mouse with android phone. But I am using Bluetooth and the touchscreen as input. You can look into win32 api functions for controlling com port.
You can also you sockets to send coords over tcp/ip. Setting up Bluetooth/Sockets is fairly easy once you understand the api calls. Let me know if you need more assistance.
use C++ code to controll the pointer location. SetCursorpos(x,y).Enjoy