A Converter You Won’t Have: PS/2 Mouse To Serial Mouse

When did you last buy a mouse? Did it have a little adapter in the box? There was a time when if you bought a USB mouse, in the box was also an adapter to allow it to be used with the older PS/2 interface. And if you were to go back a few more years into the past, you’d have found when you bought a mouse with a PS/2 connector fitted, it may well have come with an adapter for a 9-pin RS232 serial port. Those mice from a decade or more ago would have contained the software to recognise the interface into which they were plugged, and emulate it accordingly. It is unlikely then that you could take a modern USB-only device and an unholy chain of USB-to-PS/2-to-serial adapters, and have it work as a serial mouse. Want to run Windows 3.1 on a 386DX? You need a serial mouse.

Happily, [matze525] has come along with a solution for those of you with a need to drive an ancient PC with a serial mouse. He’s created a PS/2 to RS232 mouse converter, and it takes the form of a little PCB with an AT90S2313P microcontroller to do the translation and an RS232 level converter chip.

It might sound like a rather unexpected device to produce, but we can see it fills an important niche. In the early 1990s mice were not the reliable optical devices we have today, instead they had nasty mechanical connections inside, or if you were extremely lucky, optical encoder wheels. The supply of still-reliable RS232 mice must therefore be dwindling, and if you have a Windows 3.1 PC to keep alive then we can see the ability to use a more modern pointing device has a lot going for it.

If you have one of those machines from that era that came with proprietary interfaces, maybe you can make use of a USB to quadrature converter.

Mouse Mis-Clicking? We Got You.

A mouse with malfunctioning buttons can be a frustrating to deal with — and usually a short leap to percussive maintenance. Standard fixes may not always last due to inferior build quality of the components, or when the microswitch won’t close at all. But, for mice that double/triple-click, will release when dragging, or mis-click on release, this Arduino-based hack may be the good medicine you’re after.

Instructables user [themoreyouknow]’s method cancels click malfunctions by latching the mouse’s controller switch trace to ‘on’ when pressed, keeping it there until the button normally closed contact closes again completely. Due to the confined spaces, you’ll want to use the smallest Arduino you can find, some insulating tape to prevent any shorts, and care to prevent damaging the wires this process adds to the mouse when you cram it all back together.

Before you take [themoreyouknow]’s guide as dogma, the are a few caveats to this hack; they are quick to point out that this won’t work on mice that share two pins between three buttons — without doing it the extra hard way, and that this might be trickier on gaming or other high-end mice, so attempt at your own peril.

Speaking of gaming mice, we recently featured a way to add some extra functionality to your mouse — cheating optional — as well as how to stash a PC inside an old Logitech model.

Someone Finally Did It With A 555

[Jarunzel] needed a device that would automatically click the left button on a mouse at a pre-set interval. For regular Hackaday readers, this is an easy challenge. You could do it with an ATtiny85 using the VUSB library, a few resistors and diodes, and a bit of code that emulates a USB device that constantly sends mouse clicks over USB every few seconds. You could also do it with a Raspberry Pi Zero, using the USB gadget protocol. Now, this mouse-clicking gadget would be connected to the Internet (!), programmable with Node or whatever the kids are using these days, and would have some major blog cred. If you’re feeling adventurous, this mouse clicker gadget could be built with an STM32, Cypress PSoC, or whatever microcontroller you have in your magical bag of hacker tricks.

Then again, you could also do it with a 555 timer.

The reason [Jarunzel] couldn’t use any of the fancy hackertools for this build is because the system wouldn’t accept two mouse devices. No matter, because Maplin has a neat kit with a 555 timer and a relay. The relay is wired up across the microswitch in the mouse, and setting the values correctly makes the mouse click about once per second, with a click duration of about 100ms. Good enough.

With the kit built, wired into the mouse, a small app built to test the device, and a nice project box constructed, [Jarunzel] had exactly what he needed. There’s even a video of this mouse clicker in action. You can check out that riveting footage below.

Continue reading “Someone Finally Did It With A 555”

Injecting Code Into Mouse Firmware Should Be Your Next Hack

Here’s a DEF CON talk that uses tools you likely have and it should be your next hacking adventure. In their Saturday morning talk [Mark Williams] and [Rob Stanely] walked through the process of adding their own custom code to a gaming mouse. The process is a crash course in altering a stock firmware binary while still retaining the original functionality.

The jumping off point for their work is the esports industry. The scope of esporting events has blown up in recent years. The International 2016 tournament drew 17,000 attendees with 5 million watching online. The prize pool of $20 million ($19 million of that crowdfunded through in-game purchases) is a big incentive to gain a competitive edge to win. Contestants are allowed to bring their own peripherals which begs the questions: can you alter a stock gaming mouse to do interesting things?

The steelseries Sensei mouse was selected for the hack because it has an overpowered mircocontroller: the STM32F103CB. With 128 KB of flash the researchers guessed there would be enough extra room for them to add code. STM32 chips are programmed over ST-Link, which is available very inexpensively through the ST Discovery boards. They chose the STM32F4DISCOVERY which runs around  $20.

Perhaps the biggest leap in this project is that the firmware wasn’t read-protected. Once the data, clock, and ground pads on the underside of the board were connected to the Discovery board the firmware was easy to dump and the real fun began.

They first looked through the binary for a large block of zero values signifying unused space in flash. The injected firmware is designed to enumerate as a USB keyboard, open Notepad, then type out, save, and execute a PowerShell script before throwing back to the stock firmware (ensuring the mouse would still function as a mouse). Basically, this builds a USB Rubber Ducky into stock mouse firmware.

There are a few useful skills that make taking on this project a worthwhile learning experience. To compile your custom code correctly you need to choose the correct offset address for where it will end up once pasted into the firmware binary. The vector table of the original code must be rewritten to jump to the injected code first, and it will need to jump back to the mouse execution once it has run. The program flow on the left shows this. Both of these jumps require the program counter and registers to be saved and restored. The ARM stack is subtractive and the address will need to be updated to work with the added code.

The talk ended with a live demo that worked like a charm. You can check out the code in the MDHomeBrew repo. In this case the PowerShell script adds keyboard shortcuts for DOOM cheats. But like we said before, the experience of getting under the hood with the firmware binary is where the value will be for most people. With this success under your belt you can take on more difficult challenges like [Sprite_TM’s] gaming keyboard hack where the firmware couldn’t easily be dumped and an update binary was quite obsfucated.

Unholy Mashup Of SpaceMouse And Sculpt Keyboard Is Rather Well Done

What do you do if you have a pair of input device peripherals for your computer, but they are from different manufacturers and thus not available as a single unit? If you are [Marco van Nieuwenhoven], you combine the two to make a mashup single peripheral.

[Marco]’s two peripherals were a 3Dconnexion SpaceMouse Wireless, and a Microsoft Sculpt Keyboard. His mashup isn’t featured here because it simply is a mashup, after all anyone with a hot glue gun could combine the two, instead he’s created a single peripheral that almost looks as though it could have been manufactured that way. It’s not complexity we’re looking at here, but elegance!

The Sculpt keyboard fortunately has a large palm rest in which the electronics and batteries sit, and he’s carefully measured the footprint of the top half of the SpaceMouse before hand cutting a very neat aperture to take it. The SpaceMouse PCB is attached below the aperture, and the bottom of the palm rest is attached with a little bit of padding to ensure a snug fit. The result: a combined input device to be proud of!

Of course, if this keyboard isn’t special enough for you, how about a typewriter?

Hackaday Prize Entry: Dongle For A Headless Pi

Mass production means that there’s a lot of great hardware out there for dirt cheap. But it also means that the manufacturer isn’t going to spend years working on the firmware to squeeze every last feature out of it. Nope, that’s up to us.

[deqing] took a Bluetooth Low Energy / USB dongle and re-vamped the firmware to turn it into a remote keyboard and mouse, and then wrote a phone app to control it. The result? Plug the USB dongle in, and the computer thinks it sees a keyboard and mouse. Connect the phone via BLE, and you’re typing — even if you don’t have your trusty Model F by your side.

[Deqing] points out that ergonomics and latency will make you hate using this in the long term, but it’s just meant to work until you’ve got SSH up and running on that headless single-board Linux thing. If you’ve ever worked with the USB or BLE specifications, you can appreciate that there’s a bit of work behind the scenes in making everything plug and play, and the web-based interface is admirably slick.

Kudos, [deqing]!

A Universal USB To Quadrature Encoder

Computer mice existed long before the Mac, and most of the old 8-bit computers had some software that could use a mouse. These mice had balls and quadrature encoders. While converters to turn these old mice into USB devices exist, going the other way isn’t so common. [Simon] has developed the answer to that problem in the form of SmallyMouse2. It turns a USB mouse into something that can be used with the BBC Micro, Acorn Master, Acorn Archimedes, Amiga, Atari ST and more.

The design of the SmallyMouse2 uses an AT90USB microcontroller that supports USB device and host mode, and allows for a few GPIOs. This microcontroller effectively converts a USB mouse into a BBC Micro user port AMX mouse, generic quadrature mouse, and a 10-pin expansion header. The firmware uses the LUFA USB stack, a common choice for these weird USB to retrocomputer projects.

The project is completely Open Source, and all the files to replicate this project from the KiCad project to the firmware are available on [Simon]’s GitHub. If you have one of these classic retrocomputers sitting in your attic, it might be a good time to check if you still have the mouse. If not, this is the perfect project to delve into to the classic GUIs of yesteryear.