Skip to content

Commit 4a68774

Browse files
committed
docs: update usage guide
1 parent 204aa16 commit 4a68774

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ local function events(dev, initial_state)
5959
end
6060
end
6161

62+
---@return Event
6263
local function iter(state)
6364
local rc, ev = 0, Event:new()
6465

@@ -91,6 +92,28 @@ for ev in events(dev, initial_state) do
9192
end
9293
```
9394

95+
### Initializing a UInputDevice
96+
97+
```lua
98+
local Device = require("evdev.device")
99+
local UIDevice = require("evdev.uinput-device")
100+
101+
---@param uidev UInputDevice
102+
local function print_uinput_device(uidev)
103+
print("============", "===")
104+
print("= FD: ", uidev:fd())
105+
print("= SysPath: ", uidev:syspath())
106+
print("= DevNode: ", uidev:devnode())
107+
print("============", "===")
108+
end
109+
110+
local dev = Device:new("/dev/input/event7")
111+
112+
local uidev = UIDevice:new(dev)
113+
114+
print_uinput_device(uidev)
115+
```
116+
94117
## License
95118

96119
Licensed under the MIT License. Check the [LICENSE](./LICENSE) file for details.

0 commit comments

Comments
 (0)