hidtools.util module — hid-tools documentation

# hidtools.util module

class BusType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `IntEnum`

  The numerical bus type (`0x3` for USB, `0x5` for Bluetooth, see

    `linux/input.h`)

  ADB = 23
  AMD_SFH = 32
  AMIGA = 22
  ATARI = 27
  BLUETOOTH = 5
  CEC = 30
  GAMEPORT = 20
  GSC = 26
  HIL = 4
  HOST = 25
  I2C = 24
  I8042 = 17
  INTEL_ISHTP = 31
  ISA = 16
  ISAPNP = 2
  PARPORT = 21
  PCI = 1
  RMI = 29
  RS232 = 19
  SPI = 28
  UNKNOWN = 0
  USB = 3
  VIRTUAL = 6
  XTKBD = 18

to_twos_comp(val, bits)

twos_comp(val, bits)

  compute the 2’s complement of val.

  Parameters:

    - val (int) – the value to compute the two’s complement for

    - bits (int) – size of val in bits