from collections import deque INT = "i" INT2 = "ii" INT5 = "iiiii" SHORT = "h" USHORT = "H" SHORT4 = "hhhh" SIZEOF_INT2 = struct.calcsize(INT2) # Initialize the ioctl constants from ioctl import _IOC, _IO, _IOW, _IOR, _IOC_READ # taken from /usr/include/linux/input.h EVIOCGVERSION = _IOR(69, 0x01, INT) # get driver version */ EVIOCGID = _IOR(69, 0x02, SHORT4) # get device ID */ EVIOCGREP = _IOR(69, 0x03, INT2) # get repeat settings */ EVIOCSREP = _IOW(69, 0x03, INT2) # set repeat settings */ EVIOCGKEYCODE = _IOR(69, 0x04, INT2) # get keycode */ EVIOCSKEYCODE = _IOW(69, 0x04, INT2) # set keycode */ EVIOCGKEY = _IOR(69, 0x05, INT2) # get key value */ EVIOCGNAME = _IOC(_IOC_READ, 69, 0x06, 255) # get device name */ EVIOCGPHYS = _IOC(_IOC_READ, 69, 0x07, 255) # get physical location */ EVIOCGUNIQ = _IOC(_IOC_READ, 69, 0x08, 255) # get unique identifier */ EVIOCRMFF = _IOW(69, 0x81, INT) # Erase a force effect */ EVIOCSGAIN = _IOW(69, 0x82, USHORT) # Set overall gain */ EVIOCSAUTOCENTER = _IOW(69, 0x83, USHORT) # Enable or disable auto-centering */ EVIOCGEFFECTS = _IOR( 69, 0x84, INT) # Report number of effects playable at the same time */
def EVIOCGABS(abs): return _IOR(69, 0x40 + abs, INT5) # get abs value/limits */
from collections import deque INT = "i" INT2 = "ii" INT5 = "iiiii" SHORT = "h" USHORT = "H" SHORT4 = "hhhh" SIZEOF_INT2 = struct.calcsize(INT2) # Initialize the ioctl constants from ioctl import _IOC, _IO, _IOW, _IOR, _IOC_READ # taken from /usr/include/linux/input.h EVIOCGVERSION = _IOR(69, 0x01, INT) # get driver version */ EVIOCGID = _IOR(69, 0x02, SHORT4) # get device ID */ EVIOCGREP = _IOR(69, 0x03, INT2) # get repeat settings */ EVIOCSREP = _IOW(69, 0x03, INT2) # set repeat settings */ EVIOCGKEYCODE = _IOR(69, 0x04, INT2) # get keycode */ EVIOCSKEYCODE = _IOW(69, 0x04, INT2) # set keycode */ EVIOCGKEY = _IOR(69, 0x05, INT2) # get key value */ EVIOCGNAME = _IOC(_IOC_READ, 69, 0x06, 255)# get device name */ EVIOCGPHYS = _IOC(_IOC_READ, 69, 0x07, 255)# get physical location */ EVIOCGUNIQ = _IOC(_IOC_READ, 69, 0x08, 255)# get unique identifier */ EVIOCRMFF = _IOW(69, 0x81, INT) # Erase a force effect */ EVIOCSGAIN = _IOW(69, 0x82, USHORT) # Set overall gain */ EVIOCSAUTOCENTER= _IOW(69, 0x83, USHORT) # Enable or disable auto-centering */ EVIOCGEFFECTS = _IOR(69, 0x84, INT) # Report number of effects playable at the same time */ EVIOCGRAB = _IOW(69, 0x90, INT) # Grab/Release device */
# features to be queried with CIOCASYMFEAT ioctl CRF_MOD_EXP = (1 << CRK_MOD_EXP) CRF_MOD_EXP_CRT = (1 << CRK_MOD_EXP_CRT) CRF_DSA_SIGN = (1 << CRK_DSA_SIGN) CRF_DSA_VERIFY = (1 << CRK_DSA_VERIFY) CRF_DH_COMPUTE_KEY = (1 << CRK_DH_COMPUTE_KEY) # ioctl's. Compatible with old linux cryptodev.h CRIOGET = _IOWR(ord('c'), 101, sizeof(c_uint32)) CIOCGSESSION = _IOWR(ord('c'), 102, sizeof(session_op)) CIOCFSESSION = _IOW(ord('c'), 103, sizeof(c_uint32)) CIOCCRYPT = _IOWR(ord('c'), 104, sizeof(crypt_op)) CIOCKEY = _IOWR(ord('c'), 105, sizeof(crypt_kop)) CIOCASYMFEAT = _IOR(ord('c'), 106, sizeof(c_uint32)) CIOCGSESSINFO = _IOWR(ord('c'), 107, sizeof(session_info_op)) # to indicate that CRIOGET is not required in linux CRIOGET_NOT_NEEDED = 1 # additional ioctls for AEAD CIOCAUTHCRYPT = _IOWR(ord('c'), 109, sizeof(crypt_auth_op)) # additional ioctls for asynchronous operation. # These are conditionally enabled since version 1.6. CIOCASYNCCRYPT = _IOW(ord('c'), 110, sizeof(crypt_op)) CIOCASYNCFETCH = _IOR(ord('c'), 111, sizeof(crypt_op))
def EVIOCGABS(axis): return ioctl._IOR(ord('E'), 0x40 + axis, "ffffff") # get abs value/limits