Bug 247292

Summary: evdev: ESupport using 'Eisu' & 'Kana' keys via Bluetooth
Product: Base System Reporter: Yuichiro NAITO <naito.yuichiro>
Component: kernAssignee: Vladimir Kondratyev <wulf>
Status: Closed FIXED    
Severity: Affects Some People CC: emaste, wulf
Priority: --- Keywords: easy, feature, needs-qa
Version: 12.1-RELEASEFlags: koobs: maintainer-feedback? (wulf)
koobs: mfc-stable12?
Hardware: Any   
OS: Any   
Attachments:
Description Flags
evdev.patch none

Description Yuichiro NAITO 2020-06-16 01:17:42 UTC
Created attachment 215595 [details]
evdev.patch

Modern Xorg reads key events from /dev/input/? via libinput.
Due to lack of conversion table entry in evdev,
I can't use 'Eisu' & 'Kana' keys of Apple Wireless Keyboard JIS.

These keys are assigned to same scan code of 'Hangul_Hanja' & 'Hangul' by Apple.
Evdev already has 'Hangul_Hanja' & 'Hangul' entry in USB scan code map.
So I added same key code in set1 scan code map.

Please apply to attached 'evdev.patch' to head source tree.
I also want to MFC to stable-12.
Thank you.
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2020-06-16 08:12:30 UTC
Thank you for your report and patch
Comment 2 Vladimir Kondratyev freebsd_committer 2020-06-16 21:27:32 UTC
Thank you for patch. It looks good to me.

There are 2 questions left:

1. Is it real bluetooth (not RF-dongle based) keyboard?
2. If it is, what the 'sysctl kern.evdev.rcpt_mask' returns on your host?

Native bluetooth HID to evdev conversion table resides in usr.sbin/bluetooth/bthidd/btuinput.c. It is active when kern.evdev.rcpt_mask sysctl is set to 12. Could you test it?
Comment 3 Yuichiro NAITO 2020-06-17 06:07:40 UTC
(In reply to Vladimir Kondratyev from comment #2)

> 1. Is it real bluetooth (not RF-dongle based) keyboard?

Yes, My bluetooth dongle is as follows.

ubt0 on uhub0
ubt0: <vendor 0x0a12 CSR8510 A10, class 224/1, rev 2.00/88.91, addr 2> on usbus0


> 2. If it is, what the 'sysctl kern.evdev.rcpt_mask' returns on your
host?

`sysctl kern.evdev.rcpt_mask` show as follows.

$ sysctl kern.evdev.rcpt_mask
kern.evdev.rcpt_mask: 3

`sysctl kern.evdev` shows as follows.

$ sysctl kern.evdev
kern.evdev.input.5.uniq: 
kern.evdev.input.5.phys: ums0
kern.evdev.input.5.id: { bustype = 0x0003, vendor = 0x056e, product = 0x0107, version = 0x0000 }
kern.evdev.input.5.name: Compx wireless dongle, class 0/0, rev 1.10/1.00, addr 3
kern.evdev.input.3.uniq: 
kern.evdev.input.3.phys: ukbd0
kern.evdev.input.3.id: { bustype = 0x0003, vendor = 0x056e, product = 0x0107, version = 0x0000 }
kern.evdev.input.3.name: Compx wireless dongle, class 0/0, rev 1.10/1.00, addr 3
kern.evdev.input.4.uniq: 10:9a:dd:99:ba:ce
kern.evdev.input.4.phys: 00:1b:dc:06:ca:6a
kern.evdev.input.4.id: { bustype = 0x0005, vendor = 0x0000, product = 0x0000, version = 0x0000 }
kern.evdev.input.4.name: Bluetooth Keyboard, bdaddr 10:9a:dd:99:ba:ce
kern.evdev.input.2.uniq: 
kern.evdev.input.2.phys: atkbd0
kern.evdev.input.2.id: { bustype = 0x0011, vendor = 0x0001, product = 0x0001, version = 0x0000 }
kern.evdev.input.2.name: AT keyboard
kern.evdev.input.1.uniq: 
kern.evdev.input.1.phys: kbdmux0
kern.evdev.input.1.id: { bustype = 0x0006, vendor = 0x0000, product = 0x0000, version = 0x0000 }
kern.evdev.input.1.name: System keyboard multiplexer
kern.evdev.input.0.uniq: 
kern.evdev.input.0.phys: sysmouse
kern.evdev.input.0.id: { bustype = 0x0006, vendor = 0x0000, product = 0x0000, version = 0x0000 }
kern.evdev.input.0.name: System mouse
kern.evdev.sysmouse_t_axis: 0
kern.evdev.rcpt_mask: 3

I'm also using RF-dongle based mouse but not keyboard.
But RF-dongle can be shown as ums0 and ukb0.

>Native bluetooth HID to evdev conversion table resides in usr.sbin/bluetooth/bthidd/btuinput.c. It is active when kern.evdev.rcpt_mask sysctl is set to 12. Could you test it?

When I set `sysctl kern.evdev.rcpt_mask=12`,
'Eisu' and 'Kana' key events are read from libevent with GENERIC (not my patched) kernel.

And I'm sorry that I made a mistake about FreeBSD version.
I'm using the bluetooth keyboard for 12.1-RELEASE machine.
So all information above are FreeBSD 12.1-RELEASE.

I tried FreeBSD-Current(r362253) machine, kern.evdev.rcpt_mask was 12.
And 'Eisu' and 'Kana' key events are read from libevent.
Comment 4 commit-hook freebsd_committer 2020-06-17 08:36:13 UTC
A commit references this bug:

Author: wulf
Date: Wed Jun 17 08:35:36 UTC 2020
New revision: 362260
URL: https://svnweb.freebsd.org/changeset/base/362260

Log:
  evdev: Add AT translated set1 scancodes for 'Eisu' & 'Kana' keys.

  PR:		247292
  Submitted by:	Yuichiro NAITO <naito.yuichiro@gmail.com>
  MFC after:	1 week

Changes:
  head/sys/dev/evdev/evdev_utils.c
Comment 5 commit-hook freebsd_committer 2020-06-25 00:00:45 UTC
A commit references this bug:

Author: wulf
Date: Thu Jun 25 00:00:04 UTC 2020
New revision: 362597
URL: https://svnweb.freebsd.org/changeset/base/362597

Log:
  MFC r362260:

  evdev: Add AT translated set1 scancodes for 'Eisu' & 'Kana' keys.

  PR:		247292
  Submitted by:	Yuichiro NAITO <naito.yuichiro@gmail.com>

Changes:
_U  stable/12/
  stable/12/sys/dev/evdev/evdev_utils.c
Comment 6 commit-hook freebsd_committer 2020-06-25 00:01:46 UTC
A commit references this bug:

Author: wulf
Date: Thu Jun 25 00:01:25 UTC 2020
New revision: 362598
URL: https://svnweb.freebsd.org/changeset/base/362598

Log:
  MFC r362260:

  evdev: Add AT translated set1 scancodes for 'Eisu' & 'Kana' keys.

  PR:		247292
  Submitted by:	Yuichiro NAITO <naito.yuichiro@gmail.com>

Changes:
_U  stable/11/
  stable/11/sys/dev/evdev/evdev_utils.c
Comment 7 Vladimir Kondratyev freebsd_committer 2020-06-25 00:03:12 UTC
Committed. Thanks.