mirror of
https://github.com/moparisthebest/uinput-mapper
synced 2025-01-30 22:50:16 -05:00
Fix structire.
This commit is contained in:
parent
b6c5b6bee1
commit
1695c30330
@ -33,11 +33,12 @@ def create_device(specs):
|
|||||||
# * Make sure the value is properly written to 'f'
|
# * Make sure the value is properly written to 'f'
|
||||||
uidev = linux_uinput.uinput_user_dev()
|
uidev = linux_uinput.uinput_user_dev()
|
||||||
|
|
||||||
uidev.name = 'key2joy\0'
|
uidev.name = 'key2joy'
|
||||||
uidev._id.bustype = 0x03 # BUS_USB (TODO)
|
uidev._id.bustype = 0x03 # BUS_USB (TODO)
|
||||||
uidev._id.vendor = 0x42
|
uidev._id.vendor = 0x42
|
||||||
uidev._id.product = 0xBEBE
|
uidev._id.product = 0xbebe
|
||||||
uidev._id.product = 1
|
uidev._id.version = 1
|
||||||
|
|
||||||
|
|
||||||
buf = buffer(uidev)[:]
|
buf = buffer(uidev)[:]
|
||||||
print repr(buf)
|
print repr(buf)
|
||||||
|
@ -36,6 +36,7 @@ UI_FF_UPLOAD = 1
|
|||||||
UI_FF_ERASE = 2
|
UI_FF_ERASE = 2
|
||||||
|
|
||||||
import ctypes
|
import ctypes
|
||||||
|
import linux_input
|
||||||
|
|
||||||
UINPUT_MAX_NAME_SIZE = 80
|
UINPUT_MAX_NAME_SIZE = 80
|
||||||
class uinput_user_dev(ctypes.Structure):
|
class uinput_user_dev(ctypes.Structure):
|
||||||
@ -43,9 +44,10 @@ class uinput_user_dev(ctypes.Structure):
|
|||||||
("name", ctypes.c_char * UINPUT_MAX_NAME_SIZE),
|
("name", ctypes.c_char * UINPUT_MAX_NAME_SIZE),
|
||||||
("_id", linux_input.input_id),
|
("_id", linux_input.input_id),
|
||||||
("ff_effects_max", ctypes.c_uint32),
|
("ff_effects_max", ctypes.c_uint32),
|
||||||
("absmax", ctypes.c_int32),
|
("absmax", ctypes.c_int32 * linux_input.ABS_CNT),
|
||||||
("absmin", ctypes.c_int32),
|
("absmin", ctypes.c_int32 * linux_input.ABS_CNT),
|
||||||
("absfuzz", ctypes.c_int32),
|
("absfuzz", ctypes.c_int32 * linux_input.ABS_CNT),
|
||||||
("absflac", ctypes.c_int32)
|
("absflac", ctypes.c_int32 * linux_input.ABS_CNT)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
print 'SIZEOF:', ctypes.sizeof(uinput_user_dev)
|
||||||
|
Loading…
Reference in New Issue
Block a user