Previous Thread
Next Thread
Print Thread
Multikeyboard on Ubuntu? #115299
05/14/19 01:55 PM
05/14/19 01:55 PM
Joined: Feb 2014
Posts: 259
G
Golden Child Offline OP
Senior Member
Golden Child  Offline OP
Senior Member
G
Joined: Feb 2014
Posts: 259
Hi guys,

In my fiddling with trying to get the Alphasyntauri keyboard working, I thought it'd be awesome to have a second keyboard to use as a source of multiple keys to map buttons since it needs 61 keys.

I was trying to use a second keyboard as another mame input device, but -multikeyboard and -keyb_idx1 don't seem to have any effect in Ubuntu.

Looking on the net, there's a reddit post discussion that says it doesn't work:

https://www.reddit.com/r/MAME/comments/axjk7b/use_2_keyboards_as_separate_controllers/


Its a bit frustrating in that I've got literally dozens of keyboards, and keypads, but can't use them as a dedicated controller.


What's kind of cool is that you can run "evtest --grab" (though you may need to run it sudo to get the permissions) and see all of the actual key activities.

I don't recommend to do it unless you have two keyboards plugged in as it completely takes over the input device specified.

sudo evtest --grab /dev/input/by-id/usb-Macally_Macally_iMediakey-event-kbd

Code
 
$ ls /dev/input/by-id
usb-Dell_Dell_USB_Keyboard_Hub-event-if01
usb-Dell_Dell_USB_Keyboard_Hub-event-kbd
usb-Macally_Macally_iMediakey-event-kbd
usb-Macally_Macally_iMediakey-if01-event-mouse
usb-Microsoft_Microsoft_3-Button_Mouse_with_IntelliEye_TM_-event-mouse
usb-Microsoft_Microsoft_3-Button_Mouse_with_IntelliEye_TM_-mouse
usb-Microsoft_Microsoft_SideWinder_Precision_Pro__USB_-event-joystick
usb-Microsoft_Microsoft_SideWinder_Precision_Pro__USB_-joystick


$ sudo evtest --grab /dev/input/by-id/usb-Macally_Macally_iMediakey-event-kbd 
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x2222 product 0x2 version 0x100
Input device name: "Macally Macally iMediakey"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 1 (KEY_ESC)
    Event code 2 (KEY_1)
    Event code 3 (KEY_2)
    Event code 4 (KEY_3)
...
Properties:
Testing ... (interrupt to exit)
Event: time 1557840413.768819, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e0
Event: time 1557840413.768819, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 1
Event: time 1557840413.768819, -------------- SYN_REPORT ------------
Event: time 1557840413.936799, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70006
Event: time 1557840413.936799, type 1 (EV_KEY), code 46 (KEY_C), value 1
Event: time 1557840413.936799, -------------- SYN_REPORT ------------
Event: time 1557840414.096791, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70006
Event: time 1557840414.096791, type 1 (EV_KEY), code 46 (KEY_C), value 0
Event: time 1557840414.096791, -------------- SYN_REPORT ------------
Event: time 1557840414.360813, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e0
Event: time 1557840414.360813, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 0
Event: time 1557840414.360813, -------------- SYN_REPORT ------------
...


Note that pressing CTRL-C won't do the normal break from the keyboard that I'm testing. You can see the KEY_LEFTCTRL value 1, KEY_C value 1 events. It has generated key events but Ubuntu's OS isn't getting them.


What'd be so awesome is to have the ability to dedicate an additional keyboard to SDL so that SDL has exclusive use of it. (Of course this works better if you have more than one keyboard attached so you have proper control of your system).

Then special keys like CTRL+ALT+F12 won't be interpreted by the OS to go to virtual console 12: (the apple2e driver wants CTRL+OPEN APPLE+RESET and with RESET mapped to F12 and Open Apple to ALT) but that keystroke will never get to the mame driver.

Pressing CTRL+ALT+F12 on my grabbed keyboard has no effect other than to show me the keystrokes:

Code
Event: time 1557840642.295823, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e0
Event: time 1557840642.295823, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 1
Event: time 1557840642.295823, -------------- SYN_REPORT ------------
Event: time 1557840642.439842, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e3
Event: time 1557840642.439842, type 1 (EV_KEY), code 125 (KEY_LEFTMETA), value 1
Event: time 1557840642.439842, -------------- SYN_REPORT ------------
Event: time 1557840642.671821, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70045
Event: time 1557840642.671821, type 1 (EV_KEY), code 88 (KEY_F12), value 1
Event: time 1557840642.671821, -------------- SYN_REPORT ------------
Event: time 1557840642.799825, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70045
Event: time 1557840642.799825, type 1 (EV_KEY), code 88 (KEY_F12), value 0
Event: time 1557840642.799825, -------------- SYN_REPORT ------------
Event: time 1557840642.935819, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e3
Event: time 1557840642.935819, type 1 (EV_KEY), code 125 (KEY_LEFTMETA), value 0
Event: time 1557840642.935819, -------------- SYN_REPORT ------------
Event: time 1557840642.951843, type 4 (EV_MSC), code 4 (MSC_SCAN), value 700e0
Event: time 1557840642.951843, type 1 (EV_KEY), code 29 (KEY_LEFTCTRL), value 0
Event: time 1557840642.951843, -------------- SYN_RE


Then you could have a dedicated keyboard just for MAME use that doesn't care about input focus and the like.

On this macally keyboard there's even a power key:

Code
Event: time 1557841145.711506, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70066
Event: time 1557841145.711506, type 1 (EV_KEY), code 116 (KEY_POWER), value 1
Event: time 1557841145.711506, -------------- SYN_REPORT ------------
Event: time 1557841145.919494, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70066
Event: time 1557841145.919494, type 1 (EV_KEY), code 116 (KEY_POWER), value 0
Event: time 1557841145.919494, -------------- SYN_REPORT ------------


That'd be kind of cool to use that power button as a quit command for mame, for example.

Or you could have another mouse grabbed in exclusive mode for use with mame, so only mame gets its mouse activity.

Code
$ sudo evtest --grab /dev/input/by-id/usb-Microsoft_Microsoft_3-Button_Mouse_with_IntelliEye_TM_-event-mouse 
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x45e product 0x40 version 0x110
Input device name: "Microsoft Microsoft 3-Button Mouse with IntelliEye(TM)"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 272 (BTN_LEFT)
    Event code 273 (BTN_RIGHT)
    Event code 274 (BTN_MIDDLE)
  Event type 2 (EV_REL)
    Event code 0 (REL_X)
    Event code 1 (REL_Y)
    Event code 8 (REL_WHEEL)
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
Properties:
Testing ... (interrupt to exit)
Event: time 1557841888.845112, type 2 (EV_REL), code 0 (REL_X), value 1
Event: time 1557841888.845112, type 2 (EV_REL), code 1 (REL_Y), value -1
Event: time 1557841888.845112, -------------- SYN_REPORT ------------
Event: time 1557841888.989093, type 2 (EV_REL), code 0 (REL_X), value 1
Event: time 1557841888.989093, type 2 (EV_REL), code 1 (REL_Y), value -1
Event: time 1557841888.989093, -------------- SYN_REPORT ------------


Just thinking out loud.


All of the pieces are there, it's just so close to put them together.

Re: Multikeyboard on Ubuntu? [Re: Golden Child] #115300
05/14/19 03:30 PM
05/14/19 03:30 PM
Joined: Mar 2001
Posts: 16,235
USA
R
R. Belmont Online content
Very Senior Member
R. Belmont  Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,235
USA
SDL2 was originally supposed to have multiple keyboard support. It even had it briefly in the alphas, but it was buggy and they removed it because MAME was literally the only "customer" that needed it. Same for multiple mice. They've said it might come back in SDL 2.1, but who knows.


Moderated by  R. Belmont 

Who's Online Now
1 registered members (rfka01), 148 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Shout Box
Forum Statistics
Forums9
Topics8,666
Posts113,616
Members4,850
Most Online324
Dec 20th, 2018
Powered by UBB.threads™ PHP Forum Software 7.6.1.1
(Release build 20180111)
Page Time: 0.023s Queries: 15 (0.010s) Memory: 5.5924 MB (Peak: 5.7477 MB) Zlib enabled. Server Time: 2019-07-22 20:33:41 UTC