hwPortUtils module

Utilities for working with hardware connection ports.

hwPortUtils.ValidHandle(value)
class hwPortUtils.SP_DEVINFO_DATA

Bases: Structure

_fields_ = (('cbSize', <class 'ctypes.c_ulong'>), ('ClassGuid', <class 'comtypes.GUID.GUID'>), ('DevInst', <class 'ctypes.c_ulong'>), ('Reserved', <class 'ctypes.wintypes.LP_c_ulong'>))
ClassGuid

Structure/Union member

DevInst

Structure/Union member

Reserved

Structure/Union member

cbSize

Structure/Union member

hwPortUtils.PSP_DEVINFO_DATA

alias of LP_SP_DEVINFO_DATA

class hwPortUtils.SP_DEVICE_INTERFACE_DATA

Bases: Structure

_fields_ = (('cbSize', <class 'ctypes.c_ulong'>), ('InterfaceClassGuid', <class 'comtypes.GUID.GUID'>), ('Flags', <class 'ctypes.c_ulong'>), ('Reserved', <class 'ctypes.wintypes.LP_c_ulong'>))
Flags

Structure/Union member

InterfaceClassGuid

Structure/Union member

Reserved

Structure/Union member

cbSize

Structure/Union member

hwPortUtils.PSP_DEVICE_INTERFACE_DATA

alias of LP_SP_DEVICE_INTERFACE_DATA

class hwPortUtils.DEVPROPKEY

Bases: Structure

_fields_ = (('DEVPROPGUID', <class 'comtypes.GUID.GUID'>), ('DEVPROPID', <class 'ctypes.c_ulong'>))
DEVPROPGUID

Structure/Union member

DEVPROPID

Structure/Union member

class hwPortUtils.dummy

Bases: Structure

_fields_ = (('d1', <class 'ctypes.c_ulong'>), ('d2', <class 'ctypes.c_wchar'>))
_pack_ = 1
d1

Structure/Union member

d2

Structure/Union member

hwPortUtils._isDebug()
hwPortUtils._getBluetoothPortInfo(regKey: int, hwID: str) dict
hwPortUtils.listComPorts(onlyAvailable: bool = True) Iterator[dict]

List com ports on the system. :param onlyAvailable: Only return ports that are currently available. :return: Dicts including keys of port, friendlyName and hardwareID.

class hwPortUtils.BLUETOOTH_DEVICE_INFO(**kwargs)

Bases: Structure

_fields_ = (('dwSize', <class 'ctypes.c_ulong'>), ('address', <class 'ctypes.c_ulonglong'>), ('ulClassofDevice', <class 'ctypes.c_ulong'>), ('fConnected', <class 'ctypes.c_long'>), ('fRemembered', <class 'ctypes.c_long'>), ('fAuthenticated', <class 'ctypes.c_long'>), ('stLastSeen', <class 'winKernel.SYSTEMTIME'>), ('stLastUsed', <class 'winKernel.SYSTEMTIME'>), ('szName', <class 'hwPortUtils.c_wchar_Array_248'>))
address

Structure/Union member

dwSize

Structure/Union member

fAuthenticated

Structure/Union member

fConnected

Structure/Union member

fRemembered

Structure/Union member

stLastSeen

Structure/Union member

stLastUsed

Structure/Union member

szName

Structure/Union member

ulClassofDevice

Structure/Union member

hwPortUtils.getBluetoothDeviceInfo(address)
hwPortUtils.getToshibaBluetoothPortInfo(port)
hwPortUtils.getWidcommBluetoothPortInfo(port)
hwPortUtils._listDevices(deviceClass: GUID, onlyAvailable: bool = True) Iterator[tuple[c_void_p, Structure, SP_DEVINFO_DATA, c_wchar_Array_1024]]

Internal helper function to list devices on the system for a specific device class. @param deviceClass: The device class GUID. :param onlyAvailable: Only return devices that are currently available.

hwPortUtils.listUsbDevices(onlyAvailable: bool = True) Iterator[dict]

List USB devices on the system. :param onlyAvailable: Only return devices that are currently available. :return: Generates dicts including keys of usbID (VID and PID), devicePath and hardwareID.

class hwPortUtils.HIDD_ATTRIBUTES(**kwargs)

Bases: Structure

_fields_ = (('Size', <class 'ctypes.c_ulong'>), ('VendorID', <class 'ctypes.c_ushort'>), ('ProductID', <class 'ctypes.c_ushort'>), ('VersionNumber', <class 'ctypes.c_ushort'>))
ProductID

Structure/Union member

Size

Structure/Union member

VendorID

Structure/Union member

VersionNumber

Structure/Union member

hwPortUtils._getHidInfo(hwId, path)
hwPortUtils.listHidDevices(onlyAvailable: bool = True) Iterator[dict]

List HID devices on the system. @param onlyAvailable: Only return devices that are currently available. @return: Generates dicts including keys such as hardwareID,

usbID (in the form “VID_xxxx&PID_xxxx”) and devicePath.