Windows 2000 : Using mouse and keyboard with Leonardo

Hi,

I recently succeeded in installing the driver for the Arduino Leonardo on Windows 2000. I see it as a COM port and I am able to receive data on the serial port. I installed the driver by replacing the "usbser.sys" file in "C:\WINNT\System32\drivers" by one from Windows XP and it worked.

In my project, I want to control the mouse or send keyboard commands to do some task on my pc.

The problem is that the mouse and keyboard objects don't seem to work on Windows 2000. I made a simple program that send a right click every seconds on my pc. It works fine on Windows XP and Windows 10, but when I try it on Windows 2000, nothing happens.

I believe it has to do with HID drivers since the mouse and keyboard use HID objects.
I tried replacing some HID drivers with Windows XP HID drivers and so far I just got blue screens.

Any idea if there is a fix to this?

Thank you,
Santa

Perhaps it works if you install a current Windows as the host system, and W2K on it in a VM.

The best solution: start using a current Windows or Linux system, and put W2K inside your museum.

santanicclauss:
Any idea if there is a fix to this?

You are joking! :astonished:

Why would you ever want to use Windoze 2000? :roll_eyes:

DrDiettrich:
The best solution: start using a current Windows or Linux system, and put W2K inside your museum.

Linux (Mint) in fact. :sunglasses:

DrDiettrich:
Perhaps it works if you install a current Windows as the host system, and W2K on it in a VM.

The best solution: start using a current Windows or Linux system, and put W2K inside your museum.

Well I am already doing my tests on a virtual machine, and what you are proposing is working. The problem is that I want to do this on an old machine that controls an automated PCB soldering system where replacing the W2K system is mostly impossible.

I thought about using a remote desktop to control the machine but this idea doesn't seem ideal.

Paul__B:
You are joking! :astonished:

Why would you ever want to use Windoze 2000? :roll_eyes:
Linux (Mint) in fact. :sunglasses:

Trust me I would use something else than Windows 2000 if I could! Windows XP at least. My Windows 2000 runs on an old machine that controls an automated PCB soldering system where replacing it would probably not work. That's why I am trying real hard to find a solution on W2K!

Then leave that old machine untouched, or you risk to kill that entire machine.

santanicclauss:
Trust me I would use something else than Windows 2000 if I could! Windows XP at least. My Windows 2000 runs on an old machine that controls an automated PCB soldering system where replacing it would probably not work. That's why I am trying real hard to find a solution on W2K!

Would that be a convection oven? I had one for years that used Win 2k. An oven heater died and the whole oven was replaced. The WIN 2k machine had custom interface boards.

Paul

Paul_KD7HB:
Would that be a convection oven? I had one for years that used Win 2k. An oven heater died and the whole oven was replaced. The WIN 2k machine had custom interface boards.

Paul

Like I said in my reply, it is a PCB soldering system. It is on a XY table with a laser and feeder for the tin to solder electronic components on the PCB. The whole system is on an assembly line. I am trying to automate it.

Santa

Write your own service that listens on a W2K supported input port and sends the translated keys and mouse actions to the system.

santanicclauss:
Like I said in my reply, it is a PCB soldering system. It is on a XY table with a laser and feeder for the tin to solder electronic components on the PCB. The whole system is on an assembly line. I am trying to automate it.

Santa

So you have an assembly line dependent on a 20 year old computer that you can't fix when it breaks. How are you going to continue to operate when it dies?

DrDiettrich:
Write your own service that listens on a W2K supported input port and sends the translated keys and mouse actions to the system.

I'm afraid this is beyond my knowledge in programming.

PerryBebbington:
So you have an assembly line dependent on a 20 year old computer that you can't fix when it breaks. How are you going to continue to operate when it dies?

This kind of comment is not the point of this forum. Please stay within the subject.

Do you absolutely need mouse control? there are some programmable keyboard emulators that pentesters use and may work for your situation.

I'm going to look around now and see if there's some that can be activated with a button press or if this could be done on an arduino.

Can it be timed or does it need human interaction? if the latter, do you want it to be wireless?

I don't think either of these would use the COM port drivers you have though but I'll check.

I know it's hard to abandon your progress in something you've been working on but if there's a ready made solution it's definitely worth looking into.

Also, consider completely backing up the machine as it seems that it's quite important it stays working. :slight_smile:

EDIT:
Here is an HID simulator which will work for Leonardo. I don't have a Leonardo to test with but it also works on UNO which I have and am going to test myself. Pretty interesting stuff.

I couldn't find that USB I was talking about but I did find this.
and this.

Hi bears0, thank you for your reply.

To sum up my project, I have a vb.net application that communicates with a database to validate if every board in the production line is good. We use the arduino to read sensors and activate relays to validate/block the production if anything goes wrong.

bears0:
Do you absolutely need mouse control? there are some programmable keyboard emulators that pentesters use and may work for your situation.

I wanted to use mouse/keyboard to automatically chose a program on the Win2K machine so that there is less chances for human error. Mouse control would be best, keyboard if it's the only option.

bears0:
I'm going to look around now and see if there's some that can be activated with a button press or if this could be done on an arduino.

The project must be done on an arduino to control relays and read sensors. The project is based on an arduino and vb.net application.

Can it be timed or does it need human interaction? if the latter, do you want it to be wireless?

I use a scanner to scan a barcode on the vb.net app. The app sends a command to the arduino, the arduino uses mouse/keyboard libraries to automatically chose a program on the Win2K machine. The arduino communicates to the PC via Serial port with a RS232 shield. So human interaction it is.

I know it's hard to abandon your progress in something you've been working on but if there's a ready made solution it's definitely worth looking into.

I can't abandon what I've done lol. It works on every other machines I have. It's just that one machine that has the old Win2K system where I'm trying to implement the project.

Also, consider completely backing up the machine as it seems that it's quite important it stays working. :slight_smile:

Don't worry, we already have backup hard drives!

Here is an HID simulator which will work for Leonardo.

I have already found this.
The mouse and keyboard objets in the Arduino librairies already use HID objects to control the mouse or keyboard. It works fine on recent OS but I can't get it to work on Win2K.

Your links are interesting, but I really need the Arduino for the project. It is a key element.

Santa

Mouse input is unreliable, because the external mouse does not know about the mouse position on screen.

If you already have a RS232 connection between PC and Arduino, why not use it to select the right function? Who is listening to that port?

Do you have or have access to all the WIN2K software development books? Since you already know "C", there is no limit to what you can look at or do using the access you have with WIN2K.

Years ago, in a world far, far away, I was partner in a check processing software company. We used UNISYS high speed check reader/sorters. When they released check image capture, it was all done on networked WIN2K pcs. I wrote programs to query the status of the image storing programs, and to store some of our files on the UNISYS server and to do other stuff I have forgotten.

There were quite a few books covering the thousands of links available.

Paul

DrDiettrich:
Mouse input is unreliable, because the external mouse does not know about the mouse position on screen.

There are ways to get absolute mouse positioning. I have a list of possible options here:

that, on the readme of my own solution.

But I agree that controlling programs using mouse emulation is not ideal. You should definitely look for other control options like command line interface and keyboard shortcuts first, only resorting to the mouse when there is no other option.

I'm a little confused. From some of your responses it seemed like you already have the Arduino communicating with the W2K PC but in a different method than what you would like. Is that the case or did you just mean that's the goal?

Also, I was unaware the Arduino was already part of a large production line.

At this point it seems like more of an issue of finding a W2K driver. I am only 4 years older than that so i don't know how much help I could be in that respect.

You could write a program that can listen on the COM port you have and run programs accordingly. However, designing automation equipment myself, I understand that sometimes you just don't have the time or resources for that.

As DrDiettrich said, I would try to rely on keyboard only as mouse control may get wonkey in certain situations. If you can start a program using another program that would be the most reliable solution as the filepath should never change.

pert:
There are ways to get absolute mouse positioning. I have a list of possible options here:
GitHub - per1234/MouseTo: Arduino library for moving mouse pointer to absolute screen coordinates
that, on the readme of my own solution.

But I agree that controlling programs using mouse emulation is not ideal. You should definitely look for other control options like command line interface and keyboard shortcuts first, only resorting to the mouse when there is no other option.

Hi Pert, thank you for sharing your library.

Your library doesn't seem to contain any HID object so it might actually work. I will look into it.

I'm sorry to say that my library uses the Mouse library, so still using HID.

I do think the method I use for absolute positioning (moving the mouse until you are certain it's at the top corner of the screen, then making movements relative to that "homed" position) is less likely to have compatibility issues than the more advanced methods the alternatives use. I've noticed that my library is popular with the "USB Rubber Ducky" folks, and I'm guessing it's for this reason.