Bug 218627

Summary: [PATCH] add Evdev ioctl handler to the Linux compat layer
Product: Base System Reporter: Jan Kokemüller <jan.kokemueller>
Component: kernAssignee: Dmitry Chagin <dchagin>
Status: Closed FIXED    
Severity: Affects Only Me CC: dchagin, wulf
Priority: --- Keywords: patch
Version: CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
add an Evdev ioctl handler to the Linux compat layer
none
add an Evdev ioctl handler to the Linux compat layer - v2 none

Description Jan Kokemüller 2017-04-13 11:21:41 UTC
Created attachment 181754 [details]
add an Evdev ioctl handler to the Linux compat layer

I've added an Evdev ioctl handler to the Linux compat layer.
This depends on the slightly changed definition of the EVIOCGRAB and EVIOCREVOKE ioctls (bug 218625).

To test this I've built libevdev in a Ubuntu 16.04 VM and ran the programs from the "tools" folder. They work with Evdev devices created by evdevfbsd (at least on amd64, I didn't test i386).
Comment 1 Jan Kokemüller 2017-04-17 15:32:12 UTC
Created attachment 181846 [details]
add an Evdev ioctl handler to the Linux compat layer - v2

I've updated the patch. Some comments are clarified and EVIOCRMFF (which is another IOWINT ioctl like EVIOCGRAB and EVIOCREVOKE) is now also translated.

Changing the definition of EVIOCGRAB and EVIOCREVOKE is not needed as I've learned (see bug 218625).

EVIOCRMFF is untested as it's related to force feedback (unsupported on FreeBSD for now).
Comment 2 Vladimir Kondratyev freebsd_committer freebsd_triage 2017-04-18 14:42:57 UTC
There are 3 more ioctls with directions defined in Linux and FreeBSD differently:

ioctl            Linux FreeBSD
EVIOCGKEYCODE(2) _IOR  _IOWR
EVIOCGMASK       _IOR  _IOW

They are not supported in in-kernel evdev driver yet, but should work in webcamd cuse-backed driver
Comment 3 commit-hook freebsd_committer freebsd_triage 2017-04-23 07:44:42 UTC
A commit references this bug:

Author: dchagin
Date: Sun Apr 23 07:43:51 UTC 2017
New revision: 317323
URL: https://svnweb.freebsd.org/changeset/base/317323

Log:
  Add Evdev ioctl handler to the Linuxulator.

  PR:		218627
  Submitted by:	Jan Kokem?ller
  Reported by:	Jan Kokem?ller
  MFC after:	1 week

Changes:
  head/sys/compat/linux/linux_ioctl.c
  head/sys/compat/linux/linux_ioctl.h
Comment 4 Dmitry Chagin freebsd_committer freebsd_triage 2017-04-23 07:52:19 UTC
grab
Comment 5 commit-hook freebsd_committer freebsd_triage 2017-04-30 06:15:49 UTC
A commit references this bug:

Author: dchagin
Date: Sun Apr 30 06:14:58 UTC 2017
New revision: 317602
URL: https://svnweb.freebsd.org/changeset/base/317602

Log:
  MFC r317323:

  Add Evdev ioctl handler to the Linuxulator.

  PR:		218627

Changes:
_U  stable/11/
  stable/11/sys/compat/linux/linux_ioctl.c
  stable/11/sys/compat/linux/linux_ioctl.h