changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / lisp/ffi/evdev/input.lisp

changeset 684: 29fe829a7ac3
child: ebe3315b7add
author: Richard Westhaver <ellis@rwest.io>
date: Sun, 29 Sep 2024 00:31:24 -0400
permissions: -rw-r--r--
description: evdev and io/kbd
1 ;;; input.lisp --- Linux Input Subsystem Wrappers
2 
3 ;;
4 
5 ;;; Code:
6 (in-package :evdev/input)
7 
8 ;; from linux/time.h
9 (define-alien-type timeval
10  (struct timeval
11  (tv-sec sb-unix:time-t)
12  (tv-nsec long)))
13 
14 (define-alien-type input-event
15  (struct input-event
16  (time timeval)
17  (type (unsigned 16))
18  (code (unsigned 16))
19  (value (signed 32))))
20 
21 (define-alien-type input-id
22  (struct input-id
23  (bustype (unsigned 16))
24  (vendor (unsigned 16))
25  (product (unsigned 16))
26  (version (unsigned 16))))
27 
28 (define-alien-type input-absinfo
29  (struct input-absinfo
30  (value signed)
31  (minimum signed)
32  (maximum signed)
33  (fuzz signed)
34  (flat signed)
35  (resolution signed)))
36 
37 (define-alien-type input-keymap-entry
38  (struct input-keymap-entry
39  (flags unsigned-char)
40  (len unsigned-char)
41  (index unsigned-short)
42  (keycode unsigned)
43  (scancode (array (unsigned 8) 32))))
44 
45 (define-alien-type input-mask
46  (struct input-mask
47  (type unsigned)
48  (codes-size unsigned)
49  (codes-ptr (unsigned 64))))
50 
51 (define-alien-type ff-replay
52  (struct ff-replay
53  (length unsigned-short)
54  (delay unsigned-short)))
55 
56 (define-alien-type ff-trigger
57  (struct ff-trigger
58  (button unsigned-short)
59  (interval unsigned-short)))
60 
61 (define-alien-type ff-envelope
62  (struct ff-envelope
63  (attack-length unsigned-short)
64  (attack-level unsigned-short)
65  (fade-length unsigned-short)
66  (fade-level unsigned-short)))
67 
68 (define-alien-type ff-constant-effect
69  (struct ff-constant-effect
70  (level short)
71  (envelop ff-envelope)))
72 
73 (define-alien-type ff-ramp-effect
74  (struct ff-ramp-effect
75  (start-level short)
76  (end-level short)
77  (envelope ff-envelope)))
78 
79 (define-alien-type ff-condition-effect
80  (struct ff-condition-effect
81  (right-saturation unsigned-short)
82  (left-saturation unsigned-short)
83  (right-coeff short)
84  (left-coeff short)
85  (deadband unsigned-short)
86  (center short)))
87 
88 (define-alien-type ff-periodic-effect
89  (struct ff-periodic-effect
90  (waveform unsigned-short)
91  (period unsigned-short)
92  (magnitutde short)
93  (offset short)
94  (phase unsigned-short)
95  (envelope ff-envelope)
96  (custom-len unsigned)
97  (custom-data (* short))))
98 
99 (define-alien-type ff-rumble-effect
100  (struct ff-rumble-effect
101  (strong-magnitutde unsigned-short)
102  (weak-magnitude unsigned-short)))
103 
104 (define-alien-type ff-effect
105  (struct ff-effect
106  (type unsigned-short)
107  (id short)
108  (direction unsigned-short)
109  (trigger ff-trigger)
110  (replay ff-replay)
111  (u (sb-alien:union u
112  (constant ff-constant-effect)
113  (ramp ff-ramp-effect)
114  (periodic ff-periodic-effect)
115  (condition (array ff-condition-effect 2))
116  (rumble ff-rumble-effect)))))