changelog shortlog graph tags branches changeset files revisions annotate raw help

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

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