depmod: export static device node information to modules.devname
[mit.git] / tests / data / src / input_map.c
blob2be8ace4d90104211dd94aec7c639f17f9b056b9
1 /* Simple file with an INPUT map in it. */
2 #define __stringify_1(x) #x
3 #define __stringify(x) __stringify_1(x)
5 #define MODULE_GENERIC_TABLE(gtype,name) \
6 static const unsigned long __module_##gtype##_size \
7 __attribute__ ((unused)) = sizeof(struct gtype##_id); \
8 static const struct gtype##_id * __module_##gtype##_table \
9 __attribute__ ((unused)) = name; \
10 extern const struct gtype##_id __mod_##gtype##_table \
11 __attribute__ ((unused, alias(__stringify(name))))
13 #define MODULE_DEVICE_TABLE(type,name) \
14 MODULE_GENERIC_TABLE(type##_device,name)
16 #define INPUT_DEVICE_ID_MATCH_VENDOR 2
17 #define INPUT_DEVICE_ID_MATCH_PRODUCT 4
18 #define INPUT_DEVICE_ID_MATCH_VERSION 8
20 #define INPUT_DEVICE_ID_MATCH_EVBIT 0x010
21 #define INPUT_DEVICE_ID_MATCH_KEYBIT 0x020
22 #define INPUT_DEVICE_ID_MATCH_RELBIT 0x040
23 #define INPUT_DEVICE_ID_MATCH_ABSBIT 0x080
24 #define INPUT_DEVICE_ID_MATCH_MSCIT 0x100
25 #define INPUT_DEVICE_ID_MATCH_LEDBIT 0x200
26 #define INPUT_DEVICE_ID_MATCH_SNDBIT 0x400
27 #define INPUT_DEVICE_ID_MATCH_FFBIT 0x800
29 #define INPUT_DEVICE_ID_MATCH_DEVICE\
30 (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT)
31 #define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION\
32 (INPUT_DEVICE_ID_MATCH_DEVICE | INPUT_DEVICE_ID_MATCH_VERSION)
34 #define EV_MAX 0x1f
35 #define KEY_MAX 0x1ff
36 #define REL_MAX 0x0f
37 #define ABS_MAX 0x3f
38 #define MSC_MAX 0x07
39 #define LED_MAX 0x0f
40 #define REP_MAX 0x01
41 #define SND_MAX 0x07
42 #define FF_MAX 0x7f
44 #define BIT(x) (1UL<<((x)%BITS_PER_LONG))
45 #define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
47 struct input_id {
48 unsigned short bustype;
49 unsigned short vendor;
50 unsigned short product;
51 unsigned short version;
54 struct input_device_id {
56 unsigned long flags;
58 struct input_id id;
60 unsigned long evbit[NBITS(EV_MAX)];
61 unsigned long keybit[NBITS(KEY_MAX)];
62 unsigned long relbit[NBITS(REL_MAX)];
63 unsigned long absbit[NBITS(ABS_MAX)];
64 unsigned long mscbit[NBITS(MSC_MAX)];
65 unsigned long ledbit[NBITS(LED_MAX)];
66 unsigned long sndbit[NBITS(SND_MAX)];
67 unsigned long ffbit[NBITS(FF_MAX)];
69 unsigned long driver_info;
72 #define EV_SND 0x12
73 #define EV_KEY 0x01
75 static struct input_device_id kbd_ids[] = {
77 .flags = INPUT_DEVICE_ID_MATCH_EVBIT,
78 .evbit = { BIT(EV_KEY) },
82 .flags = INPUT_DEVICE_ID_MATCH_EVBIT,
83 .evbit = { BIT(EV_SND) },
84 },
86 { }, /* Terminating entry */
89 MODULE_DEVICE_TABLE(input, kbd_ids);