pyedbglib.util

pyedbglib.util.binary

Packing and unpacking numbers into bytearrays of 8-bit values with various endian encodings

pyedbglib.util.binary.pack_be16(value)

Packs a 16-bit value into a bytearray in big-endian form

Parameters:

value – input value

Returns:

16-bit big endian bytearray representation of the input value

pyedbglib.util.binary.pack_be24(value)

Packs a 24-bit value into a bytearray in big-endian form

Parameters:

value – input value

Returns:

24-bit big endian bytearray representation of the input value

pyedbglib.util.binary.pack_be32(value)

Packs a 32-bit value into a bytearray in big-endian form

Parameters:

value – input value

Returns:

32-bit big endian bytearray representation of the input value

pyedbglib.util.binary.pack_le16(value)

Packs a 16-bit value into a bytearray in little-endian form

Parameters:

value – input value

Returns:

16-bit little endian bytearray representation of the input value

pyedbglib.util.binary.pack_le24(value)

Packs a 24-bit value into a bytearray in little-endian form

Parameters:

value – input value

Returns:

24-bit little endian bytearray representation of the input value

pyedbglib.util.binary.pack_le32(value)

Packs a 32-bit value into a bytearray in little-endian form

Parameters:

value – input value

Returns:

32-bit little endian bytearray representation of the input value

pyedbglib.util.binary.unpack_be16(data)

Unpacks a big-endian 16-bit value from a bytearray

Parameters:

data – 16-bit big endian bytearray representation of an integer

Returns:

integer value

pyedbglib.util.binary.unpack_be24(data)

Unpacks a big-endian 24-bit value from a bytearray

Parameters:

data – 24-bit big endian bytearray representation of an integer

Returns:

integer value

pyedbglib.util.binary.unpack_be32(data)

Unpacks a big-endian 32-bit value from a bytearray

Parameters:

data – 32-bit big endian bytearray representation of an integer

Returns:

integer value

pyedbglib.util.binary.unpack_le16(data)

Unpacks a little-endian 16-bit value from a bytearray

Parameters:

data – 16-bit little endian bytearray representation of an integer

Returns:

integer value

pyedbglib.util.binary.unpack_le24(data)

Unpacks a little-endian 32-bit value from a bytearray

Parameters:

data – 24-bit little endian bytearray representation of an integer

Returns:

integer value

pyedbglib.util.binary.unpack_le32(data)

Unpacks a little-endian 32-bit value from a bytearray

Parameters:

data – 32-bit little endian bytearray representation of an integer

Returns:

integer value

pyedbglib.util.chopper

Data chopper for preparing data for transport over USB

class pyedbglib.util.chopper.DataChopper(size, padding=None)

Bases: object

This class is implemented to prepare data for transfers over USB

chopper(data)

This function chops a large list of data into smaller chunks based on packageSize

If padding is specified any list is padded to packageSize

Parameters:

data

Returns:

list of chopped lists

static fix_data_type(data)

Checks if the incoming data is OK to send

Parameters:

data – Input data

Returns:

list of valid data to send

pyedbglib.util.print_helpers

Generating string representations of variables for nice printouts

pyedbglib.util.print_helpers.bytelist_to_hex_string(bytelist)
Parameters:

bytelist – list of byte values

Returns:

String representation of the bytelist with each item as a byte value on the format 0xXX