input / dt-bindings: Unify defining of evdev codes
Subsystems (4)
cover input / dt-bindings: Unify defining of evdev codes
Hi All,
Here is a patch-set to unify the defining of evdev codes between uapi/linux/input.h and dt-bindings/input/input.h by using a single shared file, rather then manually keeping things in sync.
The third patch is mainly included as an example using some new / extra evcodes this makes available in dts files.
Assuming everyone involved likes this, I believe it is best for the first 2 patches to be both merged to Dmitry's input tree, as the second patch depends on the first one.
Regards,
Hans
PATCH 1/3 input: Add an input-event-codes header file
Add an input-event-codes header file and move all type and axis defines there.
The purpose of this new header file is to have a single canonical source for event-codes which can be used outside of C-code too. One example of such usage is the use of event-codes in devicetree source files.
---
.../uapi/linux/{input.h => input-event-codes.h} | 421 +----------
include/uapi/linux/input.h | 788 +--------------------
2 files changed, 11 insertions(+), 1198 deletions(-)
copy include/uapi/linux/{input.h => input-event-codes.h} (65%)include/uapi/linux/input-event-codes.h renamed from include/uapi/linux/input.h +10 -411
@@ -1,160 +1,19 @@/* +* Input event codes +* +* *** IMPORTANT *** +* This file is not only included from C-code but also from devicetree source +* files. As such this file MUST only contain comments and defines. +* * Copyright (c) 1999-2002 Vojtech Pavlik +* Copyright (c) 2015 Hans de Goede <[email protected]> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. */ -#ifndef _UAPI_INPUT_H -#define _UAPI_INPUT_H - - -#ifndef __KERNEL__ -#include <sys/time.h> -#include <sys/ioctl.h> -#include <sys/types.h> -#include <linux/types.h> -#endif - - -/* -* The event structure itself -*/ - -struct input_event { -struct timeval time; -__u16 type; -__u16 code; -__s32 value; -}; - -/* -* Protocol version. -*/ - -#define EV_VERSION 0x010001 - -/* -* IOCTLs (0x00 - 0x7f) -*/ - -struct input_id { -__u16 bustype; -__u16 vendor; -__u16 product; -__u16 version; -}; - -/** -* struct input_absinfo - used by EVIOCGABS/EVIOCSABS ioctls -* @value: latest reported value for the axis. -* @minimum: specifies minimum value for the axis. -* @maximum: specifies maximum value for the axis. -* @fuzz: specifies fuzz value that is used to filter noise from -* the event stream. -* @flat: values that are within this value will be discarded by -* joydev interface and reported as 0 instead. -* @resolution: specifies resolution for the values reported for -* the axis. -* -* Note that input core does not clamp reported values to the -* [minimum, maximum] limits, such task is left to userspace. -* -* Resolution for main axes (ABS_X, ABS_Y, ABS_Z) is reported in -* units per millimeter (units/mm), resolution for rotational axes -* (ABS_RX, ABS_RY, ABS_RZ) is reported in units per radian. -*/ -struct input_absinfo { -__s32 value; -__s32 minimum; -__s32 maximum; -__s32 fuzz; -__s32 flat; -__s32 resolution; -}; - -/** -* struct input_keymap_entry - used by EVIOCGKEYCODE/EVIOCSKEYCODE ioctls -* @scancode: scancode represented in machine-endian form. -* @len: length of the scancode that resides in @scancode buffer. -* @index: index in the keymap, may be used instead of scancode -* @flags: allows to specify how kernel should handle the request. For -* example, setting INPUT_KEYMAP_BY_INDEX flag indicates that kernel -* should perform lookup in keymap by @index instead of @scancode -* @keycode: key code assigned to this scancode -* -* The structure is used to retrieve and modify keymap data. Users have -* option of performing lookup either by @scancode itself or by @index -* in keymap entry. EVIOCGKEYCODE will also return scancode or index -* (depending on which element was used to perform lookup). -*/ -struct input_keymap_entry { -#define INPUT_KEYMAP_BY_INDEX (1 << 0) -__u8 flags; -__u8 len; -__u16 index; -__u32 keycode; -__u8 scancode[32 ]; -}; - -#define EVIOCGVERSION _IOR('E', 0x01, int)/* get driver version */ -#define EVIOCGID _IOR('E', 0x02, struct input_id)/* get device ID */ -#define EVIOCGREP _IOR('E', 0x03, unsigned int[2])/* get repeat settings */ -#define EVIOCSREP _IOW('E', 0x03, unsigned int[2])/* set repeat settings */ - -#define EVIOCGKEYCODE _IOR('E', 0x04, unsigned int[2])/* get keycode */ -#define EVIOCGKEYCODE_V2 _IOR('E', 0x04, struct input_keymap_entry) -#define EVIOCSKEYCODE _IOW('E', 0x04, unsigned int[2])/* set keycode */ -#define EVIOCSKEYCODE_V2 _IOW('E', 0x04, struct input_keymap_entry) - -#define EVIOCGNAME (len) _IOC(_IOC_READ, 'E', 0x06, len)/* get device name */ -#define EVIOCGPHYS (len) _IOC(_IOC_READ, 'E', 0x07, len)/* get physical location */ -#define EVIOCGUNIQ (len) _IOC(_IOC_READ, 'E', 0x08, len)/* get unique identifier */ -#define EVIOCGPROP (len) _IOC(_IOC_READ, 'E', 0x09, len)/* get device properties */ - -/** -* EVIOCGMTSLOTS(len) - get MT slot values -* @len: size of the data buffer in bytes -* -* The ioctl buffer argument should be binary equivalent to -* -* struct input_mt_request_layout { -* __u32 code; -* __s32 values[num_slots]; -* }; -* -* where num_slots is the (arbitrary) number of MT slots to extract. -* -* The ioctl size argument (len) is the size of the buffer, which -* should satisfy len = (num_slots + 1) * sizeof(__s32). If len is -* too small to fit all available slots, the first num_slots are -* returned. -* -* Before the call, code is set to the wanted ABS_MT event type. On -* return, values[] is filled with the slot values for the specified -* ABS_MT code. -* -* If the request code is not an ABS_MT value, -EINVAL is returned. -*/ -#define EVIOCGMTSLOTS (len) _IOC(_IOC_READ, 'E', 0x0a, len) - -#define EVIOCGKEY (len) _IOC(_IOC_READ, 'E', 0x18, len)/* get global key state */ -#define EVIOCGLED (len) _IOC(_IOC_READ, 'E', 0x19, len)/* get all LEDs */ -#define EVIOCGSND (len) _IOC(_IOC_READ, 'E', 0x1a, len)/* get all sounds status */ -#define EVIOCGSW (len) _IOC(_IOC_READ, 'E', 0x1b, len)/* get all switch states */ - -#define EVIOCGBIT (ev,len) _IOC(_IOC_READ, 'E', 0x20 + (ev), len)/* get event bits */ -#define EVIOCGABS (abs) _IOR('E', 0x40 + (abs), struct input_absinfo)/* get abs value/limits */ -#define EVIOCSABS (abs) _IOW('E', 0xc0 + (abs), struct input_absinfo)/* set abs value/limits */ - -#define EVIOCSFF _IOC(_IOC_WRITE, 'E', 0x80, sizeof(struct ff_effect))/* send a force effect to a force feedback device */ -#define EVIOCRMFF _IOW('E', 0x81, int)/* Erase a force effect */ -#define EVIOCGEFFECTS _IOR('E', 0x84, int)/* Report number of effects playable at the same time */ - -#define EVIOCGRAB _IOW('E', 0x90, int)/* Grab/Release device */ -#define EVIOCREVOKE _IOW('E', 0x91, int)/* Revoke device access */ - -#define EVIOCSCLOCKID _IOW('E', 0xa0, int)/* Set clockid to be used for timestamps */ +#ifndef _UAPI_INPUT_EVENT_CODES_H +#define _UAPI_INPUT_EVENT_CODES_H/* * Device properties and quirks
@@ -943,264 +802,4 @@ struct input_keymap_entry {#define SND_MAX 0x07#define SND_CNT (SND_MAX+1) -/* -* IDs. -*/ - -#define ID_BUS 0 -#define ID_VENDOR 1 -#define ID_PRODUCT 2 -#define ID_VERSION 3 - -#define BUS_PCI 0x01 -#define BUS_ISAPNP 0x02 -#define BUS_USB 0x03 -#define BUS_HIL 0x04 -#define BUS_BLUETOOTH 0x05 -#define BUS_VIRTUAL 0x06 - -#define BUS_ISA 0x10 -#define BUS_I8042 0x11 -#define BUS_XTKBD 0x12 -#define BUS_RS232 0x13 -#define BUS_GAMEPORT 0x14 -#define BUS_PARPORT 0x15 -#define BUS_AMIGA 0x16 -#define BUS_ADB 0x17 -#define BUS_I2C 0x18 -#define BUS_HOST 0x19 -#define BUS_GSC 0x1A -#define BUS_ATARI 0x1B -#define BUS_SPI 0x1C - -/* -* MT_TOOL types -*/ -#define MT_TOOL_FINGER 0 -#define MT_TOOL_PEN 1 -#define MT_TOOL_PALM 2 -#define MT_TOOL_MAX 2 - -/* -* Values describing the status of a force-feedback effect -*/ -#define FF_STATUS_STOPPED 0x00 -#define FF_STATUS_PLAYING 0x01 -#define FF_STATUS_MAX 0x01 - -/* -* Structures used in ioctls to upload effects to a device -* They are pieces of a bigger structure (called ff_effect) -*/ - -/* -* All duration values are expressed in ms. Values above 32767 ms (0x7fff) -* should not be used and have unspecified results. -*/ - -/** -* struct ff_replay - defines scheduling of the force-feedback effect -* @length: duration of the effect -* @delay: delay before effect should start playing -*/ -struct ff_replay { -__u16 length; -__u16 delay; -}; - -/** -* struct ff_trigger - defines what triggers the force-feedback effect -* @button: number of the button triggering the effect -* @interval: controls how soon the effect can be re-triggered -*/ -struct ff_trigger { -__u16 button; -__u16 interval; -}; - -/** -* struct ff_envelope - generic force-feedback effect envelope -* @attack_length: duration of the attack (ms) -* @attack_level: level at the beginning of the attack -* @fade_length: duration of fade (ms) -* @fade_level: level@the end of fade -* -* The @attack_level and @fade_level are absolute values; when applying -* envelope force-feedback core will convert to positive/negative -* value based on polarity of the default level of the effect. -* Valid range for the attack and fade levels is 0x0000 - 0x7fff -*/ -struct ff_envelope { -__u16 attack_length; -__u16 attack_level; -__u16 fade_length; -__u16 fade_level; -}; - -/** -* struct ff_constant_effect - defines parameters of a constant force-feedback effect -* @level: strength of the effect; may be negative -* @envelope: envelope data -*/ -struct ff_constant_effect { -__s16 level; -struct ff_envelope envelope; -}; - -/** -* struct ff_ramp_effect - defines parameters of a ramp force-feedback effect -* @start_level: beginning strength of the effect; may be negative -* @end_level: final strength of the effect; may be negative -* @envelope: envelope data -*/ -struct ff_ramp_effect { -__s16 start_level; -__s16 end_level; -struct ff_envelope envelope; -}; - -/** -* struct ff_condition_effect - defines a spring or friction force-feedback effect -* @right_saturation: maximum level when joystick moved all way to the right -* @left_saturation: same for the left side -* @right_coeff: controls how fast the force grows when the joystick moves -* to the right -* @left_coeff: same for the left side -* @deadband: size of the dead zone, where no force is produced -* @center: position of the dead zone -*/ -struct ff_condition_effect { -__u16 right_saturation; -__u16 left_saturation; - -__s16 right_coeff; -__s16 left_coeff; - -__u16 deadband; -__s16 center; -}; - -/** -* struct ff_periodic_effect - defines parameters of a periodic force-feedback effect -* @waveform: kind of the effect (wave) -* @period: period of the wave (ms) -* @magnitude: peak value -* @offset: mean value of the wave (roughly) -* @phase: 'horizontal' shift -* @envelope: envelope data -* @custom_len: number of samples (FF_CUSTOM only) -* @custom_data: buffer of samples (FF_CUSTOM only) -* -* Known waveforms - FF_SQUARE, FF_TRIANGLE, FF_SINE, FF_SAW_UP, -* FF_SAW_DOWN, FF_CUSTOM. The exact syntax FF_CUSTOM is undefined -* for the time being as no driver supports it yet. -* -* Note: the data pointed by custom_data is copied by the driver. -* You can therefore dispose of the memory after the upload/update. -*/ -struct ff_periodic_effect { -__u16 waveform; -__u16 period; -__s16 magnitude; -__s16 offset; -__u16 phase; - -struct ff_envelope envelope; - -__u32 custom_len; -__s16 __user *custom_data; -}; - -/** -* struct ff_rumble_effect - defines parameters of a periodic force-feedback effect -* @strong_magnitude: magnitude of the heavy motor -* @weak_magnitude: magnitude of the light one -* -* Some rumble pads have two motors of different weight. Strong_magnitude -* represents the magnitude of the vibration generated by the heavy one. -*/ -struct ff_rumble_effect { -__u16 strong_magnitude; -__u16 weak_magnitude; -}; - -/** -* struct ff_effect - defines force feedback effect -* @type: type of the effect (FF_CONSTANT, FF_PERIODIC, FF_RAMP, FF_SPRING, -* FF_FRICTION, FF_DAMPER, FF_RUMBLE, FF_INERTIA, or FF_CUSTOM) -* @id: an unique id assigned to an effect -* @direction: direction of the effect -* @trigger: trigger conditions (struct ff_trigger) -* @replay: scheduling of the effect (struct ff_replay) -* @u: effect-specific structure (one of ff_constant_effect, ff_ramp_effect, -* ff_periodic_effect, ff_condition_effect, ff_rumble_effect) further -* defining effect parameters -* -* This structure is sent through ioctl from the application to the driver. -* To create a new effect application should set its @id to -1; the kernel -* will return assigned @id which can later be used to update or delete -* this effect. -* -* Direction of the effect is encoded as follows: -* 0 deg -> 0x0000 (down) -* 90 deg -> 0x4000 (left) -* 180 deg -> 0x8000 (up) -* 270 deg -> 0xC000 (right) -*/ -struct ff_effect { -__u16 type; -__s16 id; -__u16 direction; -struct ff_trigger trigger; -struct ff_replay replay; - -union { -struct ff_constant_effect constant; -struct ff_ramp_effect ramp; -struct ff_periodic_effect periodic; -struct ff_condition_effect condition[2 ];/* One for each axis */ -struct ff_rumble_effect rumble; - } u; -}; - -/* -* Force feedback effect types -*/ - -#define FF_RUMBLE 0x50 -#define FF_PERIODIC 0x51 -#define FF_CONSTANT 0x52 -#define FF_SPRING 0x53 -#define FF_FRICTION 0x54 -#define FF_DAMPER 0x55 -#define FF_INERTIA 0x56 -#define FF_RAMP 0x57 - -#define FF_EFFECT_MIN FF_RUMBLE -#define FF_EFFECT_MAX FF_RAMP - -/* -* Force feedback periodic effect types -*/ - -#define FF_SQUARE 0x58 -#define FF_TRIANGLE 0x59 -#define FF_SINE 0x5a -#define FF_SAW_UP 0x5b -#define FF_SAW_DOWN 0x5c -#define FF_CUSTOM 0x5d - -#define FF_WAVEFORM_MIN FF_SQUARE -#define FF_WAVEFORM_MAX FF_CUSTOM - -/* -* Set ff device properties -*/ - -#define FF_GAIN 0x60 -#define FF_AUTOCENTER 0x61 - -#define FF_MAX 0x7f -#define FF_CNT (FF_MAX+1) - -#endif /* _UAPI_INPUT_H */ +#endif
include/uapi/linux/input.h +1 -787
800 lines not on this page · raw message
Signature · 1 line
2.4.3
PATCH 2/3 devicetree: bindings: use input-event-codes.h for evdev codes
In reply to Hans de GoedeAdd a symlink to uapi/linux/input-event-codes.h, and include that instead of (re)defining all the evdev type and code values in dt-bindings/input/input.h. This way we do not need to keep all the event codes synced manually.
--- include/dt-bindings/input/input-event-codes.h | 1 + include/dt-bindings/input/input.h | 510 +------------------------- 2 files changed, 2 insertions(+), 509 deletions(-) create mode 120000 include/dt-bindings/input/input-event-codes.h
include/dt-bindings/input/input-event-codes.h new file +1 -0
@@ -0,0 +1 @@ +../../uapi/linux/input-event-codes.h
include/dt-bindings/input/input.h +1 -509
516 lines not on this page · raw message
Signature · 1 line
2.4.3
PATCH 2/3 devicetree: bindings: use input-event-codes.h for evdev codes
Quoted 20 lines · Hans de Goede
Add a symlink to
uapi/linux/input-event-codes.h, and include that instead of (re)defining all the evdev type and code values indt-bindings/input/input.h. This way we do not need to keep all the event codes synced manually.Signed-off-by Hans de Goede <[email protected]>--- include/dt-bindings/input/input-event-codes.h | 1 + include/dt-bindings/input/input.h | 510 +------------------- ------ 2 files changed, 2 insertions(+), 509 deletions(-) create mode 120000 include/dt-bindings/input/input-event-codes.hinclude/dt renamed from include/dt-bindings/input/input-event-codes.h +0
-1-bindings/input/input-event-codes.hnew file mode 120000
index 0000000..693bbcd
include/dt-bindings/input/input-event-codes.h line 1
Quoted 2 lines
include/dt-bindings/input/input-event-codes.h new file +1
-0@@ -0,0 +1 @@ +../../uapi/linux/input-event-codes.h
Hrm, I think this is going to cause trouble for the split DT repository at
https://git.kernel.org/cgit/linux/kernel/git/devicetree/devicetree-rebasing.git/
Since ../../ == include in both trees I think I can make it work by including include/uapi/linux in the conversion, either wholesale (easiest) or partially (potentially cleaner).
Any opinions on that?
In principal I ought to regenerate the tree from scratch such that include/uapi/linux was "always" there and has history but I think we can live with it just appearing at some point in time wen the conversion script was updated?
AIUI these values are required to only be used with properties whose names are of the form "linux,*", otherwise there would be strong complaints about include Linux uapi stuff into a generic device-tree binding.
Ian.
PATCH 2/3 devicetree: bindings: use input-event-codes.h for evdev codes
Hi,
Quoted 27 lines · Ian Campbell
Quoted 20 lines · Hans de Goede
Add a symlink to
uapi/linux/input-event-codes.h, and include that instead of (re)defining all the evdev type and code values indt-bindings/input/input.h. This way we do not need to keep all the event codes synced manually.Signed-off-by Hans de Goede <[email protected]>--- include/dt-bindings/input/input-event-codes.h | 1 + include/dt-bindings/input/input.h | 510 +------------------- ------ 2 files changed, 2 insertions(+), 509 deletions(-)create mode 120000
include/dt-bindings/input/input-event-codes.hinclude/dt renamed from include/dt-bindings/input/input-event-codes.h +0
-1-bindings/input/input-event-codes.hnew file mode 120000
index 0000000..693bbcdinclude/dt-bindings/input/input-event-codes.h line 1
Quoted 2 lines
include/dt-bindings/input/input-event-codes.h new file +1
-0@@ -0,0 +1 @@ +../../uapi/linux/input-event-codes.hHrm, I think this is going to cause trouble for the split DT repository at
https://git.kernel.org/cgit/linux/kernel/git/devicetree/devicetree-rebasing.git/
Quoted 5 lines
Since ../../ == include in both trees I think I can make it work by including
include/uapi/linuxin the conversion, either wholesale (easiest) or partially (potentially cleaner).Any opinions on that?
The intend of the symlink was that the conversion script would copy the target, rather then follow the symlink. This sorta assumes that there are will be not symlinks under dt-bindings which link to files inside dt-bindings and thus should be preserved as symlinks.
If the copy done in the script will follow the symlink then nothing should really change for the split DT repo.
Quoted 9 lines
In principal I ought to regenerate the tree from scratch such that
include/uapi/linuxwas "always" there and has history but I think we can live with it just appearing at some point in time wen the conversion script was updated?AIUI these values are required to only be used with properties whose names are of the form "linux,*", otherwise there would be strong complaints about include Linux uapi stuff into a generic device-tree binding.
Correct, these values are only for linux,* properties, which is why I initially put them in a file named dt-bindings/input/linux-event-codes.h
Regards,
Hans
PATCH 2/3 devicetree: bindings: use input-event-codes.h for evdev codes
Quoted 42 lines · Hans de Goede
Hi,
Quoted 32 lines · Ian Campbell
Quoted 23 lines · Hans de Goede
Add a symlink to
uapi/linux/input-event-codes.h, and include that instead
of (re)defining all the evdev type and code values indt-bindings/input/input.h. This way we do not need to keep all the event codes synced manually.Signed-off-by Hans de Goede <[email protected]>--- include/dt-bindings/input/input-event-codes.h | 1 + include/dt-bindings/input/input.h | 510 +-------------- ----- ------ 2 files changed, 2 insertions(+), 509 deletions(-)create mode 120000
include/dt-bindings/input/input-event-codes.hinclude/dt renamed from include/dt-bindings/input/input-event-codes.h +0
-1-bindings/input/input-event-codes.hnew file mode 120000
index 0000000..693bbcdinclude/dt-bindings/input/input-event-codes.h line 1
Quoted 2 lines
include/dt-bindings/input/input-event-codes.h new file +1
-0@@ -0,0 +1 @@ +../../uapi/linux/input-event-codes.hHrm, I think this is going to cause trouble for the split DT repository at
https://git.kernel.org/cgit/linux/kernel/git/devicetree/devicetree-reba
sing.git/Quoted 6 lines
Since ../../ == include in both trees I think I can make it work by including
include/uapi/linuxin the conversion, either wholesale (easiest)
or partially (potentially cleaner).Any opinions on that?
Quoted 7 lines
The intend of the symlink was that the conversion script would copy the target, rather then follow the symlink. This sorta assumes that there are will be not symlinks under dt-bindings which link to files inside dt-bindings and thus should be preserved as symlinks.
If the copy done in the script will follow the symlink then nothing should really change for the split DT repo.
Interesting idea. I'll see if I can make the conversion routine do that.
TBH I have a horrid feeling that this is going to be beyond git rewrite -branch, at least in the mode it is used in today.
Quoted 7 lines
Quoted 7 lines
In principal I ought to regenerate the tree from scratch such that
include/uapi/linuxwas "always" there and has history but I think we can
live with it just appearing at some point in time wen the conversion script
was updated?
Quoted 8 lines
Quoted 5 lines
AIUI these values are required to only be used with properties whose names
are of the form "linux,*", otherwise there would be strong complaints about
include Linux uapi stuff into a generic device-tree binding.Correct, these values are only for linux,* properties, which is why I initially put them in a file named
dt-bindings/input/linux-event-codes.h
I think that would be a better name for the symlink (but not the target of that symlink) and usage in the .dts*, given it's (hopefully) going to turn into a regular file in the exported repo.
Ian.
PATCH 2/3 devicetree: bindings: use input-event-codes.h for evdev codes
Hi,
Quoted 69 lines · Ian Campbell
Quoted 42 lines · Hans de Goede
Hi,
Quoted 32 lines · Ian Campbell
Quoted 23 lines · Hans de Goede
Add a symlink to
uapi/linux/input-event-codes.h, and include that instead
of (re)defining all the evdev type and code values indt-bindings/input/input.h. This way we do not need to keep all the event codes synced manually.Signed-off-by Hans de Goede <[email protected]>--- include/dt-bindings/input/input-event-codes.h | 1 + include/dt-bindings/input/input.h | 510 +-------------- ----- ------ 2 files changed, 2 insertions(+), 509 deletions(-)create mode 120000
include/dt-bindings/input/input-event-codes.hinclude/dt renamed from include/dt-bindings/input/input-event-codes.h +0
-1-bindings/input/input-event-codes.hnew file mode 120000
index 0000000..693bbcdinclude/dt-bindings/input/input-event-codes.h line 1
Quoted 2 lines
include/dt-bindings/input/input-event-codes.h new file +1
-0@@ -0,0 +1 @@ +../../uapi/linux/input-event-codes.hHrm, I think this is going to cause trouble for the split DT repository at
https://git.kernel.org/cgit/linux/kernel/git/devicetree/devicetree-reba
sing.git/Quoted 6 lines
Since ../../ == include in both trees I think I can make it work by including
include/uapi/linuxin the conversion, either wholesale (easiest)
or partially (potentially cleaner).Any opinions on that?
Quoted 7 lines
The intend of the symlink was that the conversion script would copy the target, rather then follow the symlink. This sorta assumes that there are will be not symlinks under dt-bindings which link to files inside dt-bindings and thus should be preserved as symlinks.
If the copy done in the script will follow the symlink then nothing should really change for the split DT repo.
Interesting idea. I'll see if I can make the conversion routine do that.
TBH I have a horrid feeling that this is going to be beyond git rewrite -branch, at least in the mode it is used in today.
Quoted 13 lines
Quoted 12 lines
In principal I ought to regenerate the tree from scratch such that
include/uapi/linuxwas "always" there and has history but I think we can
live with it just appearing at some point in time wen the conversion script
was updated?AIUI these values are required to only be used with properties whose names
are of the form "linux,*", otherwise there would be strong complaints about
include Linux uapi stuff into a generic device-tree binding.
Quoted 6 lines
Quoted 2 lines
Correct, these values are only for linux,* properties, which is why I initially put them in a file named
dt-bindings/input/linux-event-codes.hI think that would be a better name for the symlink (but not the target of that symlink) and usage in the .dts*, given it's (hopefully) going to turn into a regular file in the exported repo.
Ok I can fix this in a next version of the patch-set (once we've figured out how to deal with all this exactly).
Regards,
Hans
PATCH 2/3 devicetree: bindings: use input-event-codes.h for evdev codes
In reply to Ian CampbellQuoted 5 lines · Ian Campbell
Quoted 5 lines
The intend of the symlink was that the conversion script would copy the target, rather then follow the symlink. This sorta assumes that there are will be not symlinks under dt-bindings which link to files inside dt-bindings and thus should be preserved as symlinks.
Quoted 7 lines
Quoted 2 lines
If the copy done in the script will follow the symlink then nothing should really change for the split DT repo.
Interesting idea. I'll see if I can make the conversion routine do that.
TBH I have a horrid feeling that this is going to be beyond git rewrite -branch, at least in the mode it is used in today.
It seems that it is possible, after a fashion.
The downside is that either _all_ symlinks (which end up in the output) get flattened or some sort of black/whitelisting is needed in the conversion scripts themselves (potentially leading to issues or discontinuities) as new stuff arrives).
It isn't possible AFAICT tell if a symlink points to something outside of the converted set of paths and adjust, at least not without an unreasonable amount of overhead on each commit during the rewrite.
Since this new file would be the first symlink in the converted repo I took the former approach in my lash up to try it out, which was essentially to insert the below script into the middle of the "git ls-files | rewrite -paths.sed" pipeline which is called by git filter-branch --index-filter. Not pretty but it does seem to work.
I want to avoid switching to --tree-filter if at all possible because it checks out the tree and is therefore a _little_ I/O intensive ;-)
Ian.
#!/bin/bash
set -e
while read mode object stage path ; do
case "$mode" in
120000)
# symbolic link
deref=$(echo $GIT_COMMIT:$path | git cat-file --batch-check='deref-ok %(objectname)' --follow-symlinks)
case "$deref" in
deref-ok*)
echo -e "100644 ${deref#deref-ok } $stage\t$path"
;;
dangling*) # skip
;;
*) # the rest, missing etc
echo >&2 "Failed to parse symlink $GIT_COMMIT:$path $deref"
exit 1
;;
esac
;;
100*)
# Regular file, just pass through
echo -e "$mode $object $stage\t$path"
;;
*)
echo >&2 "Unhandled ls-tree entry: $line"
exit 1
;;
esacdone
PATCH 2/3 devicetree: bindings: use input-event-codes.h for evdev codes
Hi,
Quoted 21 lines · Ian Campbell
Quoted 5 lines · Ian Campbell
Quoted 5 lines
The intend of the symlink was that the conversion script would copy the target, rather then follow the symlink. This sorta assumes that there are will be not symlinks under dt-bindings which link to files inside dt-bindings and thus should be preserved as symlinks.
Quoted 7 lines
Quoted 2 lines
If the copy done in the script will follow the symlink then nothing should really change for the split DT repo.
Interesting idea. I'll see if I can make the conversion routine do that.
TBH I have a horrid feeling that this is going to be beyond git rewrite -branch, at least in the mode it is used in today.
It seems that it is possible, after a fashion.
The downside is that either _all_ symlinks (which end up in the output) get flattened or some sort of black/whitelisting is needed in the conversion scripts themselves (potentially leading to issues or discontinuities) as new stuff arrives).
Quoted 6 lines
It isn't possible AFAICT tell if a symlink points to something outside of the converted set of paths and adjust, at least not without an unreasonable amount of overhead on each commit during the rewrite.
Since this new file would be the first symlink in the converted repo I took the former approach in my lash up to try it out
Ack, sounds good.
Quoted 7 lines
which was essentially to
insert the below script into the middle of the "git ls-files | rewrite -paths.sed" pipeline which is called by git filter-branch --index-filter. Not pretty but it does seem to work.I want to avoid switching to --tree-filter if at all possible because it checks out the tree and is therefore a _little_ I/O intensive ;-)
Thanks for your work on this, so what does this mean for moving forward with the patch-set I posted. Can this be merged now ? And if not what are we waiting for ?
Regards,
Hans
Quoted 35 lines
Ian.
#!/bin/bash
set -e
while read mode object stage path ; do
case "$mode" in 120000) # symbolic link deref=$(echo $GIT_COMMIT:$path | git cat-file --batch-check='deref-ok %(objectname)' --follow-symlinks) case "$deref" in deref-ok*) echo -e "100644 ${deref#deref-ok } $stage\t$path" ;; dangling*) # skip ;; *) # the rest, missing etc echo >&2 "Failed to parse symlink $GIT_COMMIT:$path $deref" exit 1 ;; esac ;; 100*) # Regular file, just pass through echo -e "$mode $object $stage\t$path" ;; *) echo >&2 "Unhandled ls-tree entry: $line" exit 1 ;; esacdone
Rob Herring
maintainerPATCH 2/3 devicetree: bindings: use input-event-codes.h for evdev codes
Quoted 45 lines · Hans de Goede
Hi,
Quoted 26 lines · Ian Campbell
Quoted 8 lines · Ian Campbell
Quoted 8 lines
The intend of the symlink was that the conversion script would copy the target,
rather then follow the symlink. This sorta assumes that there are will be not
symlinks under dt-bindings which link to files inside dt-bindings and thus
should be preserved as symlinks.Quoted 8 lines
Quoted 3 lines
If the copy done in the script will follow the symlink then nothing should
really change for the split DT repo.Interesting idea. I'll see if I can make the conversion routine do that.
TBH I have a horrid feeling that this is going to be beyond git rewrite -branch, at least in the mode it is used in today.
It seems that it is possible, after a fashion.
The downside is that either _all_ symlinks (which end up in the output) get
flattened or some sort of black/whitelisting is needed in the conversion scripts themselves (potentially leading to issues or discontinuities) as new stuff arrives).Quoted 8 lines
It isn't possible AFAICT tell if a symlink points to something outside of the converted set of paths and adjust, at least not without an unreasonable
amount of overhead on each commit during the rewrite.Since this new file would be the first symlink in the converted repo I took
the former approach in my lash up to try it outAck, sounds good.
Quoted 5 lines
which was essentially to
insert the below script into the middle of the "git ls-files | rewrite -paths.sed" pipeline which is called by git filter-branch --index-filter. Not pretty but it does seem to work.
Quoted 6 lines
Quoted 2 lines
I want to avoid switching to --tree-filter if at all possible because it checks out the tree and is therefore a _little_ I/O intensive ;-)
Thanks for your work on this, so what does this mean for moving forward with the patch-set I posted. Can this be merged now ? And if not what are we waiting for ?
I thought you were sending another version using "linux-event-codes.h."
Anyway, for the series for DT:
Rob
PATCH 2/3 devicetree: bindings: use input-event-codes.h for evdev codes
Hi,
Quoted 46 lines · Rob Herring
Quoted 45 lines · Hans de Goede
Hi,
Quoted 26 lines · Ian Campbell
Quoted 8 lines · Ian Campbell
Quoted 8 lines
The intend of the symlink was that the conversion script would copy the target,
rather then follow the symlink. This sorta assumes that there are will be not
symlinks under dt-bindings which link to files inside dt-bindings and thus
should be preserved as symlinks.Quoted 8 lines
Quoted 3 lines
If the copy done in the script will follow the symlink then nothing should
really change for the split DT repo.Interesting idea. I'll see if I can make the conversion routine do that.
TBH I have a horrid feeling that this is going to be beyond git rewrite -branch, at least in the mode it is used in today.
It seems that it is possible, after a fashion.
The downside is that either _all_ symlinks (which end up in the output) get
flattened or some sort of black/whitelisting is needed in the conversion scripts themselves (potentially leading to issues or discontinuities) as new stuff arrives).Quoted 8 lines
It isn't possible AFAICT tell if a symlink points to something outside of the converted set of paths and adjust, at least not without an unreasonable
amount of overhead on each commit during the rewrite.Since this new file would be the first symlink in the converted repo I took
the former approach in my lash up to try it outAck, sounds good.
Quoted 5 lines
which was essentially to
insert the below script into the middle of the "git ls-files | rewrite -paths.sed" pipeline which is called by git filter-branch --index-filter. Not pretty but it does seem to work.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
I want to avoid switching to --tree-filter if at all possible because it checks out the tree and is therefore a _little_ I/O intensive ;-)
Thanks for your work on this, so what does this mean for moving forward with the patch-set I posted. Can this be merged now ? And if not what are we waiting for ?
I thought you were sending another version using "
linux-event-codes.h."
Yes I can do that if people want me to, I am / was waiting for things to settle down first. So if you want a v2 series with linux-event-codes.h and everything else unchanged, let me know and I'll do so.
Quoted 3 lines
Anyway, for the series for DT:
Acked-by Rob Herring <[email protected]>
Thanks,
Hans
PATCH 3/3 ARM: dts: sun4i: inet9f-rev03: Add support for game buttons / joysticks
In reply to Hans de GoedeThe inet9f-rev03 tablet has multiple fire-buttons / direction controls, add support for these using the same axis mapping as ps2 compatible game controllers with the same stick / button layout use.
---
Changes in v2:
-Do not include dt-bindings/input/evdev.h, as the necessary evdev codes
have been added to dt-bindings/input/input.h instead
--- arch/arm/boot/dts/sun4i-a10-inet9f-rev03.dts | 164 +++++++++++++++++++++++++++ 1 file changed, 164 insertions(+)
arch/arm/boot/dts/sun4i-a10-inet9f-rev03.dts +164 -0
@@ -59,6 +59,159 @@ chosen { stdout-path = "serial0:115200n8"; }; + + gpio_keys { + compatible = "gpio-keys-polled"; + pinctrl-names = "default"; + pinctrl-0 = <&key_pins_inet9f>; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + button at 0 { + label = "Left Joystick Left"; + linux,code = <ABS_X>; + linux,input-type = <EV_ABS>; + linux,input-value = <0xffffffff>; /* -1 */ + gpios = <&pio 0 6 GPIO_ACTIVE_LOW>; /* PA6 */ + }; + + button at 1 { + label = "Left Joystick Right"; + linux,code = <ABS_X>; + linux,input-type = <EV_ABS>; + linux,input-value = <1>; + gpios = <&pio 0 5 GPIO_ACTIVE_LOW>; /* PA5 */ + }; + + button at 2 { + label = "Left Joystick Up"; + linux,code = <ABS_Y>; + linux,input-type = <EV_ABS>; + linux,input-value = <0xffffffff>; /* -1 */ + gpios = <&pio 0 8 GPIO_ACTIVE_LOW>; /* PA8 */ + }; + + button at 3 { + label = "Left Joystick Down"; + linux,code = <ABS_Y>; + linux,input-type = <EV_ABS>; + linux,input-value = <1>; + gpios = <&pio 0 9 GPIO_ACTIVE_LOW>; /* PA9 */ + }; + + button at 4 { + label = "Right Joystick Left"; + linux,code = <ABS_Z>; + linux,input-type = <EV_ABS>; + linux,input-value = <0xffffffff>; /* -1 */ + gpios = <&pio 0 1 GPIO_ACTIVE_LOW>; /* PA1 */ + }; + + button at 5 { + label = "Right Joystick Right"; + linux,code = <ABS_Z>; + linux,input-type = <EV_ABS>; + linux,input-value = <1>; + gpios = <&pio 0 0 GPIO_ACTIVE_LOW>; /* PA0 */ + }; + + button at 6 { + label = "Right Joystick Up"; + linux,code = <ABS_RZ>; + linux,input-type = <EV_ABS>; + linux,input-value = <0xffffffff>; /* -1 */ + gpios = <&pio 0 3 GPIO_ACTIVE_LOW>; /* PA3 */ + }; + + button at 7 { + label = "Right Joystick Down"; + linux,code = <ABS_RZ>; + linux,input-type = <EV_ABS>; + linux,input-value = <1>; + gpios = <&pio 0 4 GPIO_ACTIVE_LOW>; /* PA4 */ + }; + + button at 8 { + label = "DPad Left"; + linux,code = <ABS_HAT0X>; + linux,input-type = <EV_ABS>; + linux,input-value = <0xffffffff>; /* -1 */ + gpios = <&pio 7 23 GPIO_ACTIVE_LOW>; /* PH23 */ + }; + + button at 9 { + label = "DPad Right"; + linux,code = <ABS_HAT0X>; + linux,input-type = <EV_ABS>; + linux,input-value = <1>; + gpios = <&pio 7 24 GPIO_ACTIVE_LOW>; /* PH24 */ + }; + + button at 10 { + label = "DPad Up"; + linux,code = <ABS_HAT0Y>; + linux,input-type = <EV_ABS>; + linux,input-value = <0xffffffff>; /* -1 */ + gpios = <&pio 7 25 GPIO_ACTIVE_LOW>; /* PH25 */ + }; + + button at 11 { + label = "DPad Down"; + linux,code = <ABS_HAT0Y>; + linux,input-type = <EV_ABS>; + linux,input-value = <1>; + gpios = <&pio 7 26 GPIO_ACTIVE_LOW>; /* PH26 */ + }; + + button at 12 { + label = "Button X"; + linux,code = <BTN_X>; + gpios = <&pio 0 16 GPIO_ACTIVE_LOW>; /* PA16 */ + }; + + button at 13 { + label = "Button Y"; + linux,code = <BTN_Y>; + gpios = <&pio 0 14 GPIO_ACTIVE_LOW>; /* PA14 */ + }; + + button at 14 { + label = "Button A"; + linux,code = <BTN_A>; + gpios = <&pio 0 17 GPIO_ACTIVE_LOW>; /* PA17 */ + }; + + button at 15 { + label = "Button B"; + linux,code = <BTN_B>; + gpios = <&pio 0 15 GPIO_ACTIVE_LOW>; /* PA15 */ + }; + + button at 16 { + label = "Select Button"; + linux,code = <BTN_SELECT>; + gpios = <&pio 0 11 GPIO_ACTIVE_LOW>; /* PA11 */ + }; + + button at 17 { + label = "Start Button"; + linux,code = <BTN_START>; + gpios = <&pio 0 12 GPIO_ACTIVE_LOW>; /* PA12 */ + }; + + button at 18 { + label = "Top Left Button"; + linux,code = <BTN_TL>; + gpios = <&pio 7 22 GPIO_ACTIVE_LOW>; /* PH22 */ + }; + + button at 19 { + label = "Top Right Button"; + linux,code = <BTN_TR>; + gpios = <&pio 0 13 GPIO_ACTIVE_LOW>; /* PA13 */ + }; + }; }; &cpu0 {
@@ -167,6 +320,17 @@ }; &pio { + key_pins_inet9f: key_pins at 0 { + allwinner,pins = "PA0", "PA1", "PA3", "PA4", + "PA5", "PA6", "PA8", "PA9", + "PA11", "PA12", "PA13", + "PA14", "PA15", "PA16", "PA17", + "PH22", "PH23", "PH24", "PH25", "PH26"; + allwinner,function = "gpio_in"; + allwinner,drive = <SUN4I_PINCTRL_10_MA>; + allwinner,pull = <SUN4I_PINCTRL_PULL_UP>; + }; + usb0_id_detect_pin: usb0_id_detect_pin at 0 { allwinner,pins = "PH4"; allwinner,function = "gpio_in";
Signature · 1 line
2.4.3