forked from mewbak/evdev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
led.go
34 lines (30 loc) · 825 Bytes
/
led.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// This file is subject to a 1-clause BSD license.
// Its contents can be found in the enclosed LICENSE file.
package evdev
import "unsafe"
// LED events are used for input and output to set and query the state of
// various LEDs on devices.
const (
LedNumLock = 0x00
LedCapsLock = 0x01
LedScrollLock = 0x02
LedCompose = 0x03
LedKana = 0x04
LedSleep = 0x05
LedSuspend = 0x06
LedMute = 0x07
LedMisc = 0x08
LedMail = 0x09
LedCharging = 0x0a
LedMax = 0x0f
LedCount = LedMax + 1
)
// LEDState returns the current, global LED state.
//
// This is only applicable to devices with EvLed event support.
func (d *Device) LEDState() Bitset {
bs := NewBitset(LedMax)
buf := bs.Bytes()
ioctl(d.fd.Fd(), _EVIOCGLED(len(buf)), unsafe.Pointer(&buf[0]))
return bs
}