Fix structire.

This commit is contained in:
Merlijn Wajer 2013-04-19 23:24:50 +02:00
parent b6c5b6bee1
commit 1695c30330
2 changed files with 10 additions and 7 deletions

View File

@ -33,11 +33,12 @@ def create_device(specs):
# * Make sure the value is properly written to 'f'
uidev = linux_uinput.uinput_user_dev()
uidev.name = 'key2joy\0'
uidev.name = 'key2joy'
uidev._id.bustype = 0x03 # BUS_USB (TODO)
uidev._id.vendor = 0x42
uidev._id.product = 0xBEBE
uidev._id.product = 1
uidev._id.product = 0xbebe
uidev._id.version = 1
buf = buffer(uidev)[:]
print repr(buf)

View File

@ -36,6 +36,7 @@ UI_FF_UPLOAD = 1
UI_FF_ERASE = 2
import ctypes
import linux_input
UINPUT_MAX_NAME_SIZE = 80
class uinput_user_dev(ctypes.Structure):
@ -43,9 +44,10 @@ class uinput_user_dev(ctypes.Structure):
("name", ctypes.c_char * UINPUT_MAX_NAME_SIZE),
("_id", linux_input.input_id),
("ff_effects_max", ctypes.c_uint32),
("absmax", ctypes.c_int32),
("absmin", ctypes.c_int32),
("absfuzz", ctypes.c_int32),
("absflac", ctypes.c_int32)
("absmax", ctypes.c_int32 * linux_input.ABS_CNT),
("absmin", ctypes.c_int32 * linux_input.ABS_CNT),
("absfuzz", ctypes.c_int32 * linux_input.ABS_CNT),
("absflac", ctypes.c_int32 * linux_input.ABS_CNT)
]
print 'SIZEOF:', ctypes.sizeof(uinput_user_dev)