Author Topic: Keyboard Injection extension  (Read 2432 times)

0 Members and 1 Guest are viewing this topic.

Offline krusty_benediction

  • CPC6128
  • ****
  • Posts: 184
  • Country: fr
  • Liked: 138
  • Likes Given: 48
Keyboard Injection extension
« on: 11:38, 05 March 17 »
Hello,

I'd like to know if it is technically possible and if yes if an hardware tech would agree to investigate on a keyboard event injector for CPC. More explanations follow:


Interface:
 - plugged on a PC compatible machine through USB connector
 - plugged as a sandwich between the CPC keybord socket in the motherboard and the plastic like wires of the keyboard or any other solution which easy to plug with no soldering

Purpose:
 - the extension is able to send keyboard and joystick event to the CPC thanks to commands send from a PC application (press a key, release a key)
 - (optional but of great interest) the extension is able to send to the PC the keyboard events (key has just been pressed, key has just been released is probably better than key is pressed)
 - (optional, with less interest) the extension can have itself another extension allowing to plug an USB keayboard and replace the original one (can be of interest for broken keyboard, or cpc towers)

Idea of usage:
 - lazy crossdeveloper:
    - (with hxcfloppy emulator usb) with one command on the PC side, the software is build, its dsk is sned on the HXC USB floppy emulator, the keys to launch it on the real CPC are automatically pressed
    - (with a romcard) with one command on the PC side, the software is build, the keys to load its sna are automatically typed
    - when the product is launch, the extension can also be used to interact with it as for any testing graphical ui tool
    -  with albireo it is even possible to automatically reset the CPC before
 - gamer:
   - (optional scenario) keys events could be registered in order to see a replay games later (if there is nothing random)
   - a suit of keys can  be sent at a specific moment (writtent by someone else) in a game where the player is able to go further
   - probably something else, no idea what a gamer do ;)
 - demoparty organiser
   - (with hxcfloppy USB emulator, and albireo) a PC software executes a (random or not) demos playlist. Albireo serves to reset the CPC, floppy emulator to serve the images, keyboard injector to type the launch command, and manage the interractions when needed (press space, cheat part selection). This can be used as well for projecting stuff during the party and for projecting the production sent for the contests


I think I would love to have such thing for the "lazy crossdeveloper" scenario; if someone thinks he could do the hardware work, I would be happy to help with the software side.

Offline PulkoMandy

  • 464 Plus
  • *****
  • Posts: 437
  • Country: fr
  • Liked: 360
  • Likes Given: 4
Re: Keyboard Injection extension
« Reply #1 on: 10:41, 06 March 17 »
There was the clavcard by Ram7 to connect a PS/2 keyboard to the CPC. It appears to have completely disappeared from the web however, and the hardware is obsolete now.

Offline gerald

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.544
  • Liked: 1092
  • Likes Given: 265
Re: Keyboard Injection extension
« Reply #2 on: 22:46, 06 March 17 »
For a external keyboard, there is my PS2CPC which should handle USB keyboard with the appropriate PS2 to USB pinout adaptor. However it might not work with modern wireless ones that do not support PS2 mode any more.

The remote control should not be a big deal, except for the connection if you want it to be solderless. The only way is to have it as an external extension for watching the PPI access (keyboard line selection) and a connection to the joystick port for driving the keyboard row.




Offline krusty_benediction

  • CPC6128
  • ****
  • Posts: 184
  • Country: fr
  • Liked: 138
  • Likes Given: 48
Re: Keyboard Injection extension
« Reply #3 on: 17:28, 07 March 17 »

The remote control should not be a big deal, except for the connection if you want it to be solderless. The only way is to have it as an external extension for watching the PPI access (keyboard line selection) and a connection to the joystick port for driving the keyboard row.


So if I translate well, it is impossible to have something like that ?

 keyboard => extension => CPC motherboard
                          ^
                          ||
                           v
                  USB on IBM PC
                     

Offline gerald

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.544
  • Liked: 1092
  • Likes Given: 265
Re: Keyboard Injection extension
« Reply #4 on: 21:13, 08 March 17 »

So if I translate well, it is impossible to have something like that ?

 keyboard => extension => CPC motherboard
                          ^
                          ||
                           v
                  USB on IBM PC
                   
I see two issues with that:
1- It will be difficult to make a ribbon connector to plug into the CPC connector
2- There is little space between the connector and the keyboard, most of it is needed so the cable is not pried and damaged.


Offline krusty_benediction

  • CPC6128
  • ****
  • Posts: 184
  • Country: fr
  • Liked: 138
  • Likes Given: 48
Re: Keyboard Injection extension
« Reply #5 on: 22:43, 08 March 17 »
I see two issues with that:
1- It will be difficult to make a ribbon connector to plug into the CPC connector
2- There is little space between the connector and the keyboard, most of it is needed so the cable is not pried and damaged.



ok
so still an impossible dream :(

Offline gerald

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.544
  • Liked: 1092
  • Likes Given: 265
Re: Keyboard Injection extension
« Reply #6 on: 18:59, 09 March 17 »
ok
so still an impossible dream :(
I would not say that.
This can still be made
- externally as stated above (Expansion port card + cable to the joystick port)
- internally like the PS2 interface but requires soldering (and a potential ribbon cable prying problem)

Offline issalig

  • CPC464
  • **
  • Posts: 39
  • Country: es
  • Liked: 19
  • Likes Given: 45
Re: Keyboard Injection extension
« Reply #7 on: 10:37, 07 May 21 »
Hi, I was thinking about a KVM switch for CPC. It would consist of an external card driven by a microcontroller and connected to PC via serial/wifi which will inject key strokes and get out screen.An application likely in Python will capture key presses on PC, and send it to the microcontroller via serial/wifi.

For the keys I was thinking to sniff/inject on the expansion port as @gerald mentioned it. I guess it should be done by listening to the 8255 traffic but I still need to guess how it works.

If you can  point me in the right direction I would be very pleased.

- externally as stated above (Expansion port card + cable to the joystick port)
For the video I have a naive idea, just incercepting video memory writings on adresses C000-FFFF but I have been informed that video is not always at this address.
« Last Edit: 12:17, 07 May 21 by issalig »

Offline gerald

  • Supporter
  • 6128 Plus
  • *
  • Posts: 1.544
  • Liked: 1092
  • Likes Given: 265
Re: Keyboard Injection extension
« Reply #8 on: 19:52, 07 May 21 »
For the keys I was thinking to sniff/inject on the expansion port as @gerald mentioned it. I guess it should be done by listening to the 8255 traffic but I still need to guess how it works.

If you can  point me in the right direction I would be very pleased.
Basically you need to monitor which keyboard line is currently selected and pull joystick line low if a key on that line is pressed.
Monitoring keyboard selected is done by looking for write to PPI port C, bit [3:0]

For the video I have a naive idea, just incercepting video memory writings on adresses C000-FFFF but I have been informed that video is not always at this address.
That's the system default address for screen memory, but can be put anywhere. And you also have to think about the screen geometry which is set by the CRTC (not even talking about demo that can change all that for every displayed lines).

The easiest way would be to capture the real video output.

 If you want a fully digital capture, the next best place would be to capture gate array input/output (mainly the 16MHz clock, CASn, data, HSYNC/VSYNC/DISPEN for the raster + iorq, A15 for the register write ) and then emulate the gate array video generation part.
Not an easy task  ;)

Offline issalig

  • CPC464
  • **
  • Posts: 39
  • Country: es
  • Liked: 19
  • Likes Given: 45
Re: Keyboard Injection extension
« Reply #9 on: 20:18, 08 May 21 »
Thanks a lot for the info, I will explore the keyboard/joystick way.
For the video, hmm, I will keep on using  my composite video board ( https://github.com/issalig/rgbs ) and a usb capturer, not a good quality but nice and handful to see it as a window on the PC.

Offline rpalmer

  • 6128 Plus
  • ******
  • Posts: 569
  • Country: au
  • Liked: 398
  • Likes Given: 19
Re: Keyboard Injection extension
« Reply #10 on: 00:56, 09 May 21 »
issalig,
I am in the process of developing a PS/2 Keyboard/Mouse interface. The interface also has a USB port on the card (also in development).
See the attached picture to get an idea of what is coming down the tube. The eventual board wont have the ZIF socket.
Basics on how it works:
The PIC 18F4550 chips runs at 25 MHz.It intercepts the 8255 Ports A and B I/O and handles what is required for keyboard/mouse response (see attached schematic and GreatCow Basic code).
The picture also shows work on a 128K SRAM replacement board to get around the issue of 4164 chips replacement becoming hard to come by.
rpalmer

Offline issalig

  • CPC464
  • **
  • Posts: 39
  • Country: es
  • Liked: 19
  • Likes Given: 45
Re: Keyboard Injection extension
« Reply #11 on: 01:59, 09 May 21 »
Great. Thanks for sharing. I will take a look, I am sure it will be very useful.