To make the programs work you need to open the file hardware/arduino/avr/cores/arduino/USBAPI.h located in your Arduino folder and make the Keyboard_::sendReport method public.
The PS2 protocol is implemented with information from: http://retired.beyondlogic.org/keyboard/keybrd.htm
USB scancodes are taken from: http://www.win.tue.nl/~aeb/linux/kbd/scancodes-14.html
Some of the code to receive the PS2 scan codes is taken from the PS2Keyboard library: http://www.pjrc.com/teensy/td_libs_PS2Keyboard.html
Information on how to use the KeyReport.modifiers field can be taken from: http://www.usb.org/developers/hidpage/HID1_11.pdf (page 56)
Hi, I get a lot of errors when compiling:
Arduino: 1.8.19 (Mac OS X), Board: "Arduino Uno"
In file included from /Users/Mustafa/Documents/Arduino/Arduino PS2 to USB HID Keyboard Converter/PS2toUSB/PS2toUSB.ino:3:0:
/Users/Mustafa/Documents/Arduino/libraries/Keyboard/src/Keyboard.h:29:2: warning: #warning "Using legacy HID core (non pluggable)" [-Wcpp]
#warning "Using legacy HID core (non pluggable)"
^~~~~~~
PS2toUSB:14:1: error: 'KeyReport' does not name a type
KeyReport report;
^~~~~~~~~
/Users/Mustafa/Documents/Arduino/Arduino PS2 to USB HID Keyboard Converter/PS2toUSB/PS2toUSB.ino: In function 'void setup()':
PS2toUSB:198:3: error: 'Keyboard' not found. Does your sketch include the line '#include <Keyboard.h>'?
Keyboard.begin();
^~~~~~~~
/Users/Mustafa/Documents/Arduino/Arduino PS2 to USB HID Keyboard Converter/PS2toUSB/PS2toUSB.ino: In function 'void report_add(uint8_t)':
PS2toUSB:208:5: error: 'report' was not declared in this scope
report.modifiers |= 1 << (k - 224);
^~~~~~
/Users/Mustafa/Documents/Arduino/Arduino PS2 to USB HID Keyboard Converter/PS2toUSB/PS2toUSB.ino:208:5: note: suggested alternative: 'remove'
report.modifiers |= 1 << (k - 224);
^~~~~~
remove
PS2toUSB:209:14: error: 'report' was not declared in this scope
} else if (report.keys[0] != k && report.keys[1] != k &&
^~~~~~
/Users/Mustafa/Documents/Arduino/Arduino PS2 to USB HID Keyboard Converter/PS2toUSB/PS2toUSB.ino:209:14: note: suggested alternative: 'remove'
} else if (report.keys[0] != k && report.keys[1] != k &&
^~~~~~
remove
/Users/Mustafa/Documents/Arduino/Arduino PS2 to USB HID Keyboard Converter/PS2toUSB/PS2toUSB.ino: In function 'void report_remove(uint8_t)':
PS2toUSB:224:5: error: 'report' was not declared in this scope
report.modifiers &= ~(1 << (k - 224));
^~~~~~
/Users/Mustafa/Documents/Arduino/Arduino PS2 to USB HID Keyboard Converter/PS2toUSB/PS2toUSB.ino:224:5: note: suggested alternative: 'remove'
report.modifiers &= ~(1 << (k - 224));
^~~~~~
remove
PS2toUSB:227:11: error: 'report' was not declared in this scope
if (report.keys[i] == k) {
^~~~~~
/Users/Mustafa/Documents/Arduino/Arduino PS2 to USB HID Keyboard Converter/PS2toUSB/PS2toUSB.ino:227:11: note: suggested alternative: 'remove'
if (report.keys[i] == k) {
^~~~~~
remove
/Users/Mustafa/Documents/Arduino/Arduino PS2 to USB HID Keyboard Converter/PS2toUSB/PS2toUSB.ino: In function 'void loop()':
PS2toUSB:271:11: error: 'Keyboard' not found. Does your sketch include the line '#include <Keyboard.h>'?
Keyboard.sendReport(&report);
^~~~~~~~
PS2toUSB:271:32: error: 'report' was not declared in this scope
Keyboard.sendReport(&report);
^~~~~~
/Users/Mustafa/Documents/Arduino/Arduino PS2 to USB HID Keyboard Converter/PS2toUSB/PS2toUSB.ino:271:32: note: suggested alternative: 'remove'
Keyboard.sendReport(&report);
^~~~~~
remove
PS2toUSB:293:11: error: 'Keyboard' not found. Does your sketch include the line '#include <Keyboard.h>'?
Keyboard.sendReport(&report);
^~~~~~~~
PS2toUSB:293:32: error: 'report' was not declared in this scope
Keyboard.sendReport(&report);
^~~~~~
/Users/Mustafa/Documents/Arduino/Arduino PS2 to USB HID Keyboard Converter/PS2toUSB/PS2toUSB.ino:293:32: note: suggested alternative: 'remove'
Keyboard.sendReport(&report);
^~~~~~
remove
Multiple libraries were found for "Keyboard.h"
Used: /Users/Mustafa/Documents/Arduino/libraries/Keyboard
Not used: /Applications/Arduino.app/Contents/Java/libraries/Keyboard
exit status 1
'KeyReport' does not name a type
Can please suggest any modification to get this working? you already put too much work into this probably its worth another look at it.
Thanks.