123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564 |
- package linux
- import "unsafe"
- type INPUT_event struct {
- Timeval Timeval
- Type uint16
- Code uint16
- Value int32
- }
- const EV_VERSION=0x010001
- type INPUT_id struct {
- Bustype uint16
- Vendor uint16
- Product uint16
- Version uint16
- }
- type INPUT_absinfo struct {
- Value int32;
- Minimum int32;
- Maximum int32;
- Fuzz int32;
- Flat int32;
- Resolution int32;
- }
- const INPUT_KEYMAP_BYINDEX = (1 << 0)
- type INPUT_keymap_entry struct {
- Flags uint8;
- Len uint8;
- Index uint16;
- Keycode uint32;
- Scancode [32]uint8;
- };
- type INPUT_mask struct {
- Type uint32;
- Codes_size uint32;
- Codes_ptr uint32;
- };
- type uint32p = [2]uint32
- const sizeof_uint32p = unsafe.Sizeof(*((*uint32p)(nil)))
- const sizeof_int32 = unsafe.Sizeof(*((*int32)(nil)))
- const sizeof_uint32 = unsafe.Sizeof(*((*uint32)(nil)))
- const sizeof_INPUT_id = unsafe.Sizeof(*((*INPUT_id)(nil)))
- const sizeof_INPUT_keymap_entry = unsafe.Sizeof(*((*INPUT_keymap_entry)(nil)))
- const sizeof_INPUT_absinfo = unsafe.Sizeof(*((*INPUT_absinfo)(nil)))
- const sizeof_INPUT_mask = unsafe.Sizeof(*((*INPUT_mask)(nil)))
- const sizeof_FF_effect = unsafe.Sizeof(*((*FF_effect)(nil)))
- var EVIOCGVERSION = IOR('E', 0x01, sizeof_int32)
- var EVIOCGID = IOR('E', 0x02, sizeof_INPUT_id)
- var EVIOCGREP = IOR('E', 0x03, sizeof_uint32p)
- var EVIOCSREP = IOW('E', 0x03, sizeof_uint32p)
- var EVIOCGKEYCODE = IOR('E', 0x04, sizeof_uint32)
- var EVIOCGKEYCODE_V2= IOR('E', 0x04, sizeof_INPUT_keymap_entry)
- var EVIOCSKEYCODE = IOW('E', 0x04, sizeof_uint32p)
- var EVIOCSKEYCODE_V2= IOW('E', 0x04, sizeof_INPUT_keymap_entry)
- func EVIOCGNAME(len uintptr) uint32{
- return IOC(IOC_READ, 'E', 0x06, len)
- }
- func EVIOCGPHYS(len uintptr) uint32 {
- return IOC(IOC_READ, 'E', 0x07, len)
- }
- func EVIOCGUNIQ(len uintptr) uint32 {
- return IOC(IOC_READ, 'E', 0x08, len)
- }
- func EVIOCGPROP(len uintptr) uint32 {
- return IOC(IOC_READ, 'E', 0x09, len)
- }
- func EVIOCGMTSLOTS(len uintptr) uint32 {
- return IOC(IOC_READ, 'E', 0x0a, len)
- }
- func EVIOCGKEY(len uintptr) uint32 {
- return IOC(IOC_READ, 'E', 0x18, len)
- }
- func EVIOCGLED(len uintptr) uint32 {
- return IOC(IOC_READ, 'E', 0x19, len)
- }
- func EVIOCGSND(len uintptr) uint32 {
- return IOC(IOC_READ, 'E', 0x1a, len)
- }
- func EVIOCGSW(len uintptr) uint32 {
- return IOC(IOC_READ, 'E', 0x1b, len)
- }
- func EVIOCGBIT(ev uint32, len uintptr) uint32 {
- return IOC(IOC_READ, 'E', 0x20 + (ev), len)
- }
- func EVIOCGABS(abs uint32) uint32 {
- return IOR('E', 0x40 + (abs), sizeof_INPUT_absinfo)
- }
- func EVIOCSABS(abs uint32) uint32 {
- return IOW('E', 0xc0 + (abs), sizeof_INPUT_absinfo)
- }
- var EVIOCSFF = IOW('E', 0x80, sizeof_FF_effect)
- var EVIOCRMFF = IOW('E', 0x81, sizeof_int32)
- var EVIOCGEFFECTS = IOR('E', 0x84, sizeof_int32)
- var EVIOCGRAB = IOW('E', 0x90, sizeof_int32)
- var EVIOCREVOKE = IOW('E', 0x91, sizeof_int32)
- var EVIOCGMASK = IOR('E', 0x92, sizeof_INPUT_mask)
- var EVIOCSMASK = IOW('E', 0x93, sizeof_INPUT_mask)
- var EVIOCSCLOCKID = IOW('E', 0xa0, sizeof_int32)
- const ID_BUS = 0
- const ID_VENDOR = 1
- const ID_PRODUCT = 2
- const ID_VERSION = 3
- const BUS_PCI = 0x01
- const BUSISAPNP = 0x02
- const BUS_USB = 0x03
- const BUS_HIL = 0x04
- const BUS_BLUETOOTH = 0x05
- const BUS_VIRTUAL = 0x06
- const BUSISA = 0x10
- const BUSI8042 = 0x11
- const BUS_XTKBD = 0x12
- const BUS_RS232 = 0x13
- const BUS_GAMEPORT = 0x14
- const BUS_PARPORT = 0x15
- const BUS_AMIGA = 0x16
- const BUS_ADB = 0x17
- const BUSI2C = 0x18
- const BUS_HOST = 0x19
- const BUS_GSC = 0x1A
- const BUS_ATARI = 0x1B
- const BUS_SPI = 0x1C
- const MT_TOOL_FINGER = 0
- const MT_TOOL_PEN = 1
- const MT_TOOL_PALM = 2
- const MT_TOOL_MAX = 2
- const FF_STATUS_STOPPED = 0x00
- const FF_STATUS_PLAYING = 0x01
- const FF_STATUS_MAX = 0x01
- type FF_replay struct {
- Length uint16
- Delay uint16
- };
- type FF_trigger struct {
- Button uint16
- Interval uint16
- };
- type FF_envelope struct {
- Attack_length uint16
- Attack_level uint16
- Fade_length uint16
- Fade_level uint16
- };
- type FF_constant_effect struct {
- Level int16
- Envelope FF_envelope
- };
- type FF_ramp_effect struct {
- Start_level int16
- End_level int16
- Envelope FF_envelope
- };
- type FF_condition_effect struct {
- Right_saturation uint16
- Left_saturation uint16
- Right_coeff int16
- Left_coeff int16
- Deadband uint16
- Center int16
- };
- type FF_periodic_effect struct {
- Waveform uint16
- Period uint16
- Magnitude int16
- Offset int16
- Phase uint16
- Envelope FF_envelope
- Custom_len uint32
- Custom_data *int16;
- };
- type FF_rumble_effect struct {
- Strong_magnitude uint16
- Weak_magnitude uint16
- };
- const FF_effect_union_size = unsafe.Sizeof(*((*FF_periodic_effect)(nil)))
- type FF_effect struct {
- Type_ uint16
- Id int16
- Direction uint16
- Trigger FF_trigger
- Replay FF_replay
-
- U [FF_effect_union_size]byte
- };
- type FF_effect_u_constant struct {
- Type_ uint16
- Id int16
- Direction uint16
- Trigger FF_trigger
- Replay FF_replay
- Constant FF_constant_effect
- };
- type FF_effect_u_ramp struct {
- Type_ uint16
- Id int16
- Direction uint16
- Trigger FF_trigger
- Replay FF_replay
- Ramp FF_ramp_effect
- };
- type FF_effect_u_periodic struct {
- Type_ uint16
- Id int16
- Direction uint16
- Trigger FF_trigger
- Replay FF_replay
- Periodic FF_periodic_effect
- };
- type FF_effect_u_condition struct {
- Type_ uint16
- Id int16
- Direction uint16
- Trigger FF_trigger
- Replay FF_replay
- Condition [2]FF_condition_effect;
- };
- type FF_effect_u_rumble struct {
- Type_ uint16
- Id int16
- Direction uint16
- Trigger FF_trigger
- Replay FF_replay
- Rumble FF_rumble_effect
- };
- const FF_RUMBLE = 0x50
- const FF_PERIODIC = 0x51
- const FF_CONSTANT = 0x52
- const FF_SPRING = 0x53
- const FF_FRICTION = 0x54
- const FF_DAMPER = 0x55
- const FFINERTIA = 0x56
- const FF_RAMP = 0x57
- const FF_EFFECT_MIN = FF_RUMBLE
- const FF_EFFECT_MAX = FF_RAMP
- const FF_SQUARE = 0x58
- const FF_TRIANGLE = 0x59
- const FF_SINE = 0x5a
- const FF_SAW_UP = 0x5b
- const FF_SAW_DOWN = 0x5c
- const FF_CUSTOM = 0x5d
- const FF_WAVEFORM_MIN = FF_SQUARE
- const FF_WAVEFORM_MAX = FF_CUSTOM
- const FF_GAIN = 0x60
- const FF_AUTOCENTER = 0x61
- const FF_MAX_EFFECTS = FF_GAIN
- const FF_MAX = 0x7f
- const FF_CNT = (FF_MAX+1)
|