Skip to content

Commit 0629f3c

Browse files
haithiumgithub-actions[bot]
authored andcommitted
docs: generate docs
1 parent a3f7f86 commit 0629f3c

6 files changed

Lines changed: 211 additions & 55 deletions

File tree

docs/api/device.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ One Linux input event returned by `Device:read()`.
1515
| [`flush()`](#fn-flush) | Drain queued events and return how many were discarded. |
1616
| [`get_repeat()`](#fn-get-repeat) | Return the current auto-repeat delay and period in milliseconds. |
1717
| [`grab()`](#fn-grab) | Take exclusive control of the input device. |
18-
| [`is_device(value)`](#fn-is-device) | Return whether a value is an `evdev.Device` instance. |
18+
| [`is_device(value)`](#fn-is-device) | Return whether a value is an [`evdev.Device`] instance. |
1919
| [`is_open()`](#fn-is-open) | Return whether this device handle still has an open file descriptor. |
2020
| [`open(path)`](#fn-open) | Open an input device by path. |
2121
| [`poll()`](#fn-poll) | Wait in the kernel until this device has input available. |
@@ -76,7 +76,7 @@ Return the underlying Linux file descriptor.
7676

7777
**Return**:
7878

79-
- `fd` (`evdev.fd?`): Linux file descriptor.
79+
- `fd` ([`evdev.fd`]`?`): Linux file descriptor.
8080

8181
**Example**:
8282

@@ -161,7 +161,7 @@ assert(dev:grab())
161161

162162
### `is_device(value)`
163163

164-
Return whether a value is an `evdev.Device` instance.
164+
Return whether a value is an [`evdev.Device`] instance.
165165

166166
**Parameters**:
167167

@@ -211,11 +211,11 @@ Open an input device by path.
211211

212212
**Parameters**:
213213

214-
- `path` (`evdev.path`)
214+
- `path` ([`evdev.path`])
215215

216216
**Return**:
217217

218-
- `dev` (`evdev.Device?`): Open input device.
218+
- `dev` ([`evdev.Device`]`?`): Open input device.
219219
- `err` (`string?`): Error message on failure.
220220

221221
**Example**:
@@ -266,7 +266,7 @@ Read one input event. Returns `nil` when no event is queued.
266266

267267
**Return**:
268268

269-
- `event` (`evdev.event?`): Next queued input event.
269+
- `event` ([`evdev.event`]`?`): Next queued input event.
270270
- `err` (`string?`): Error message on failure.
271271

272272
**Example**:
@@ -335,3 +335,12 @@ local dev = assert(Device("/dev/input/eventX"))
335335
assert(dev:grab())
336336
assert(dev:ungrab())
337337
```
338+
339+
<!-- markdownlint-disable MD053 -->
340+
<!-- prettier-ignore-start -->
341+
[`evdev.Device`]: /evdev/api/device.html
342+
[`evdev.event`]: /evdev/types.html#evdev-event
343+
[`evdev.fd`]: /evdev/types.html#evdev-fd
344+
[`evdev.path`]: /evdev/types.html#evdev-path
345+
<!-- prettier-ignore-end -->
346+
<!-- markdownlint-enable MD053 -->

docs/api/devices.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ Read metadata for one input device by path.
2727

2828
**Parameters**:
2929

30-
- `path` (`evdev.path`)
30+
- `path` ([`evdev.path`])
3131

3232
**Return**:
3333

34-
- `info` (`evdev.deviceInfo?`)
34+
- `info` ([`evdev.deviceInfo`]`?`)
3535
- `err` (`string?`)
3636

3737
**Example**:
@@ -54,7 +54,7 @@ Return the first discovered input device matching a path or a device name.
5454

5555
**Return**:
5656

57-
- `dev` (`evdev.deviceInfo?`)
57+
- `dev` ([`evdev.deviceInfo`]`?`)
5858
- `err` (`string?`)
5959

6060
**Example**:
@@ -86,7 +86,7 @@ Return all discovered input devices matching a path, alias, or device name.
8686

8787
**Return**:
8888

89-
- `devs` (`evdev.deviceInfo[]?`)
89+
- `devs` ([`evdev.deviceInfo`]`[]?`)
9090
- `err` (`string?`)
9191

9292
**Example**:
@@ -113,7 +113,7 @@ List evdev input devices under `/dev/input`.
113113

114114
**Return**:
115115

116-
- `devs` (`evdev.deviceInfo[]?`)
116+
- `devs` ([`evdev.deviceInfo`]`[]?`)
117117
- `err` (`string?`)
118118

119119
**Example**:
@@ -124,3 +124,10 @@ for _, dev in ipairs(devs) do
124124
print(dev.path, dev.name)
125125
end
126126
```
127+
128+
<!-- markdownlint-disable MD053 -->
129+
<!-- prettier-ignore-start -->
130+
[`evdev.deviceInfo`]: /evdev/types.html#evdev-deviceinfo
131+
[`evdev.path`]: /evdev/types.html#evdev-path
132+
<!-- prettier-ignore-end -->
133+
<!-- markdownlint-enable MD053 -->

docs/api/events.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Return whether an event has type `EV_ABS`.
3636

3737
**Parameters**:
3838

39-
- `event` (`evdev.event`)
39+
- `event` ([`evdev.event`])
4040

4141
**Return**:
4242

@@ -57,7 +57,7 @@ Return whether an event has type `EV_KEY`.
5757

5858
**Parameters**:
5959

60-
- `event` (`evdev.event`)
60+
- `event` ([`evdev.event`])
6161

6262
**Return**:
6363

@@ -78,7 +78,7 @@ Return whether an event is a key/button press.
7878

7979
**Parameters**:
8080

81-
- `event` (`evdev.event`)
81+
- `event` ([`evdev.event`])
8282

8383
**Return**:
8484

@@ -99,7 +99,7 @@ Return whether an event has type `EV_REL`.
9999

100100
**Parameters**:
101101

102-
- `event` (`evdev.event`)
102+
- `event` ([`evdev.event`])
103103

104104
**Return**:
105105

@@ -120,7 +120,7 @@ Return whether an event is a key/button release.
120120

121121
**Parameters**:
122122

123-
- `event` (`evdev.event`)
123+
- `event` ([`evdev.event`])
124124

125125
**Return**:
126126

@@ -141,7 +141,7 @@ Return whether an event is a key repeat.
141141

142142
**Parameters**:
143143

144-
- `event` (`evdev.event`)
144+
- `event` ([`evdev.event`])
145145

146146
**Return**:
147147

@@ -162,7 +162,7 @@ Return whether an event has type `EV_SYN`.
162162

163163
**Parameters**:
164164

165-
- `event` (`evdev.event`)
165+
- `event` ([`evdev.event`])
166166

167167
**Return**:
168168

@@ -174,3 +174,9 @@ Return whether an event has type `EV_SYN`.
174174
local e = { type = evdev.ecodes.EV_SYN }
175175
print(evdev.events.is_syn(e)) --> true
176176
```
177+
178+
<!-- markdownlint-disable MD053 -->
179+
<!-- prettier-ignore-start -->
180+
[`evdev.event`]: /evdev/types.html#evdev-event
181+
<!-- prettier-ignore-end -->
182+
<!-- markdownlint-enable MD053 -->

docs/api/selector.md

Lines changed: 37 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,39 @@ Selector for polling and reading from multiple devices.
99

1010
| Function | Description |
1111
| ------------------------------ | -------------------------------------------------------------- |
12+
| [`new(devices?)`](#fn-new) | Create a selector from an optional list of devices. |
1213
| [`add(device)`](#fn-add) | Add a device to this selector. |
1314
| [`clear()`](#fn-clear) | Remove all devices from this selector. |
1415
| [`events()`](#fn-events) | Return an iterator that yields events from registered devices. |
15-
| [`new(devices?)`](#fn-new) | Create a selector from an optional list of devices. |
1616
| [`poll()`](#fn-poll) | Wait until at least one registered device has input available. |
1717
| [`remove(device)`](#fn-remove) | Remove a device from this selector. |
1818

19+
<a id="fn-new"></a>
20+
21+
### `new(devices?)`
22+
23+
Create a selector from an optional list of devices.
24+
25+
**Parameters**:
26+
27+
- `devices?` ([`evdev.Device`]`[]`)
28+
29+
**Return**:
30+
31+
- **value** ([`evdev.Selector`])
32+
33+
**Example**:
34+
35+
```lua
36+
local evdev = require "evdev"
37+
local Device = evdev.device.open
38+
local Selector = evdev.selector.new
39+
40+
local kb1 = assert(Device("/dev/input/event5"))
41+
local kb2 = assert(Device("/dev/input/event10"))
42+
local sel = Selector({ kb1, kb2 })
43+
```
44+
1945
<a id="fn-add"></a>
2046

2147
### `add(device)`
@@ -24,7 +50,7 @@ Add a device to this selector.
2450

2551
**Parameters**:
2652

27-
- `device` (`evdev.Device`)
53+
- `device` ([`evdev.Device`])
2854

2955
**Return**:
3056

@@ -91,32 +117,6 @@ for dev, e in sel:events() do
91117
end
92118
```
93119

94-
<a id="fn-new"></a>
95-
96-
### `new(devices?)`
97-
98-
Create a selector from an optional list of devices.
99-
100-
**Parameters**:
101-
102-
- `devices?` (`evdev.Device[]`)
103-
104-
**Return**:
105-
106-
- **value** (`evdev.Selector`)
107-
108-
**Example**:
109-
110-
```lua
111-
local evdev = require "evdev"
112-
local Device = evdev.device.open
113-
local Selector = evdev.selector.new
114-
115-
local kb1 = assert(Device("/dev/input/event5"))
116-
local kb2 = assert(Device("/dev/input/event10"))
117-
local sel = Selector({ kb1, kb2 })
118-
```
119-
120120
<a id="fn-poll"></a>
121121

122122
### `poll()`
@@ -125,7 +125,7 @@ Wait until at least one registered device has input available.
125125

126126
**Return**:
127127

128-
- `devs` (`evdev.Device[]?`)
128+
- `devs` ([`evdev.Device`]`[]?`)
129129
- `err` (`string?`)
130130

131131
**Example**:
@@ -151,7 +151,7 @@ Remove a device from this selector.
151151

152152
**Parameters**:
153153

154-
- `device` (`evdev.Device`)
154+
- `device` ([`evdev.Device`])
155155

156156
**Return**:
157157

@@ -169,3 +169,10 @@ local sel = Selector({ kb1, kb2 })
169169

170170
sel:remove(kb2)
171171
```
172+
173+
<!-- markdownlint-disable MD053 -->
174+
<!-- prettier-ignore-start -->
175+
[`evdev.Device`]: /evdev/api/device.html
176+
[`evdev.Selector`]: /evdev/api/selector.html
177+
<!-- prettier-ignore-end -->
178+
<!-- markdownlint-enable MD053 -->

docs/api/uinput.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ Create a virtual input device.
4545

4646
**Parameters**:
4747

48-
- `spec?` (`evdev.uinputSpec`): Virtual device configuration.
48+
- `spec?` ([`evdev.uinputSpec`]): Virtual device configuration.
4949

5050
**Return**:
5151

52-
- `dev` (`evdev.UInput?`): Open virtual device.
52+
- `dev` ([`evdev.UInput`]`?`): Open virtual device.
5353
- `err` (`string?`): Error message on failure.
5454

5555
**Example**:
@@ -73,10 +73,10 @@ Emit one raw input event.
7373

7474
**Parameters**:
7575

76-
- `type` (`evdev.ecodes.ev`): Event type to emit.
77-
- `code` (`evdev.ecodes.key|evdev.ecodes.btn|evdev.ecodes.rel`): Event code
78-
within the selected type.
79-
- `value` (`evdev.eventValue`): Event value to send.
76+
- `type` ([`evdev.ecodes.ev`]): Event type to emit.
77+
- `code` ([`evdev.ecodes.key`] | [`evdev.ecodes.btn`] | [`evdev.ecodes.rel`]):
78+
Event code within the selected type.
79+
- `value` ([`evdev.eventValue`]): Event value to send.
8080

8181
**Return**:
8282

@@ -108,7 +108,7 @@ Get the file descriptor of the virtual device.
108108

109109
**Return**:
110110

111-
- `fd` (`evdev.fd?`): Linux file descriptor.
111+
- `fd` ([`evdev.fd`]`?`): Linux file descriptor.
112112

113113
**Example**:
114114

@@ -210,3 +210,16 @@ local ui = assert(UInput())
210210
ui:emit(evdev.ecodes.EV_KEY, evdev.ecodes.KEY_LEFTSHIFT, 0)
211211
ui:sync()
212212
```
213+
214+
<!-- markdownlint-disable MD053 -->
215+
<!-- prettier-ignore-start -->
216+
[`evdev.UInput`]: /evdev/api/uinput.html
217+
[`evdev.ecodes.btn`]: /evdev/api/ecodes.html
218+
[`evdev.ecodes.ev`]: /evdev/api/ecodes.html
219+
[`evdev.ecodes.key`]: /evdev/api/ecodes.html
220+
[`evdev.ecodes.rel`]: /evdev/api/ecodes.html
221+
[`evdev.eventValue`]: /evdev/types.html#evdev-eventvalue
222+
[`evdev.fd`]: /evdev/types.html#evdev-fd
223+
[`evdev.uinputSpec`]: /evdev/types.html#evdev-uinputspec
224+
<!-- prettier-ignore-end -->
225+
<!-- markdownlint-enable MD053 -->

0 commit comments

Comments
 (0)