Jump to content
  • 0

Are PS/2 host to device commands supported in the emulator?


Stefan
 Share

Question

Hello!

I'm trying to make a function to send a byte to a PS/2 device (the keyboard). This could be used to set different keyboard properties, such as the key repeat rate.

As far as I have seen, the Kernal only has the opposite function, to receive a byte from a PS/2 device.

It should be possible to implement such a function yourself. But there are quite a few low level steps in order to send a byte to a device. Several steps depend on timing constraints. It's easy to mess something up...

My test function doesn't hang, but it does neither produce any visible result with the commands I have tried (see included file for code).

Does anybody know if the emulator at all supports sending commands from the host to a device in this manner?

ps2.inc

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0
5 hours ago, Lorin Millsap said:

This probably belongs in the feature request. What you are trying to do should work on real hardware, but I don’t believe the emulator supports keyboard or mouse commands.


Sent from my iPhone using Tapatalk

OK. Thanks.

Maybe I just wait for the hardware.

Link to comment
Share on other sites

  • 0
  • Super Administrators
On 3/7/2021 at 4:57 AM, Stefan said:

Hello!

I'm trying to make a function to send a byte to a PS/2 device (the keyboard). This could be used to set different keyboard properties, such as the key repeat rate.

As far as I have seen, the Kernal only has the opposite function, to receive a byte from a PS/2 device.

It should be possible to implement such a function yourself. But there are quite a few low level steps in order to send a byte to a device. Several steps depend on timing constraints. It's easy to mess something up...

My test function doesn't hang, but it does neither produce any visible result with the commands I have tried (see included file for code).

Does anybody know if the emulator at all supports sending commands from the host to a device in this manner?

ps2.inc 1.88 kB · 4 downloads

No, that's basically impossible.

When running the emulator on a PC, you're dealing with several layers of abstraction, and you're not going to ever be able to send PS/2 hardware commands to a USB keyboard using software running in a User context on a PC. 

As you have surmised, this will have to wait for actual hardware.

And I agree that what you're doing is necessary.

If nothing else, the computer needs to set the LEDs. If the system is not sending back commands to the keyboard, then the CAPS LOCK and SCROLL LOCK lights will never light up. Considering how useful and sometimes necessary the CAPS key is, it's unfortunate that this has been overlooked. Hopefully, your code can be integrated into the ROM once some real hardware is available for testing. 

 

Edited by TomXP411
Link to comment
Share on other sites

  • 0

Yes, it's safe to assume that you cannot just pipe the PS/2 data stream from the emulator to the host OS.

But the emulator could listen for PS/2 commands and respond in meaningful ways, for instance turning on LEDs on the keyboard used by the host OS.

Implementing this kind of functionality might not be trivial, though. Therefore I'm satisfied waiting for the hardware. 

  • Like 1
Link to comment
Share on other sites

  • 0
36 minutes ago, mobluse said:

In Linux (e.g. Raspberry Pi OS) it's possible to turn on and off keyboard LEDs as you wish using commands both in X and in the non X Linux console, but you may have to do some configuration first.

https://www.raspberrypi.org/forums/viewtopic.php?f=41&t=251417&p=1534467

All well and good, but the emulator currently doesn't forward any of that from the emulated CPU. Feel free to submit a pull request to add it, though.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

Please review our Terms of Use