3

The goal is to connect a mouse to my raspberry Pi, and have it connected to a computer (both linux and windows will be used). I want to have a LED light up whenever I use a right mouse click. So the input would be mouse -> raspberry -> computer. Where I want the raspberry to have a led light up on certain actions.

Ideally I'd be able to configure this for not only certain mouse actions, but also keyboard.

Thing is, I have no idea where to start. Or if it is even remotely possible at all. Most challenging thing I can imagine is connecting the pi as a input peripheral. So any advice is greatly appriciated.

EDIT: Ideally the Pi would be connected as an actual USB device with a USB cable. This is to best imitate a mouse/keyboard and it's latencies.

  • 2
    Why are you trying to do this? Why spend $35 to emulate a $5 mouse? – Steve Robillard Mar 8 '16 at 12:23
  • Goal is to have a visual LED indicator for certain actions. With this and a high speed camera I want to do some testing on latencies. So I want to measure the time between the LED lighting up, and an action happening on screen. Also why use an overly expencive pi 2? becouse I have one laying around, and as a microprocessor board with output pins it seemed like it could do the job. – Downquark Mar 8 '16 at 12:33
  • It would also be a great surveillance device like the FBI used on that mobster when they couldn't crack his PGP. – SDsolar May 19 '17 at 9:26
1

Following the approach given in the question mouse -> raspberry -> computer, one solution could be to emulate an HID (Human Interface Device) with the Pi when connecting to the computer. So the Pi picks up all input coming from the mouse/keyboard, gets the info it needs (the certain action you intend to act upon), and relays all the input to the other computer faking to be a HID using it's GPIO ports.

See here (to not repeat what's written there):

0

You cannot do this directly because the Pi's USB port was occupied.

However you can use Arduino Leonardo with some SPI-to-USB-Host chip here.

-2

Here is what you need USB over IP. Your RPi will run Linux and do the thing =)

  • Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – Steve Robillard Mar 8 '16 at 13:13
  • @SteveRobillard a link is provided. I know and I've been reading the fine manual, but this question is literally has a one-line answer. Why don;t you take a look at the official website of the project I've recommended? – Alexey Vesnin Mar 8 '16 at 14:27
  • This looks indeed very promising, and like a good solution. I am slightly worried about network latency though. Initially my idea was to use the RPi as an actual USB, so with a cable, to best imitate an actual mouse. although I notice I did not explicitly mention this in my question, for which my apologies. I edited my question to include this. I will go with this if no USB sollution arises though. – Downquark Mar 8 '16 at 14:55
  • 1
    The issue is that without including the pertinent details here your answer is only good as long as that link is functional. – Steve Robillard Mar 8 '16 at 15:08
  • @SteveRobillard the issue is, that if a whole project I'm referring to will go down with their website, then an answer will be useless, indeed. But it's not a reason to include the whole source code, right? – Alexey Vesnin Mar 8 '16 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.