Skip to main content

Module providing a programmatic interface to Windows Devcon device management commands.

Project description

[!IMPORTANT] This project is under development. All source code and features on the main branch are for the purpose of testing or evaluation and not production ready.

[!IMPORTANT] Starting from version v2.0.0, the devcon.exe and devcon_x64.exe binaries are no longer included in the repository. You can download the latest version of Devcon from the Windows driver samples repository.

Remember to place them in the default location: C:\mfd_tools\devcon\

MFD Devcon

A Python module that provides a programmatic interface to Windows Device Console (DevCon) tool commands. It implements the mfd-base-tool abstract class.

More about DevCon:

Implemented methods

check_if_available() -> None: - Check if Devcon is available in system at the specified path, raises DevconNotAvailable if not

get_version() -> str: - Return N/A for Devcon as version is not available

enable_devices(device_id: str = "", pattern: str = "", reboot: bool = False) -> str: - Enable device(s) on the computer specified either by device_id or pattern. Set reboot to True for executing command with conditional reboot

disable_devices(device_id: str = "", pattern: str = "", reboot: bool = False) -> str: - Disable device(s) on the computer specified either by device_id or pattern. Set reboot to True for executing command with conditional reboot

rescan_devices() -> str: - Rescan to update the device list for the computer

remove_devices(device_id: str = "", pattern: str = "", reboot: bool = False) -> str: - Remove device(s) on the computer specified either by device_id or pattern. Set reboot to True for executing command with conditional reboot

update_drivers(device_id: str, inf_file: Union[Path, str], reboot: bool = False) -> str: - Replace the current device drivers for a device with drivers listed in the INF file

restart_devices(device_id: str = "", pattern: str = "", reboot: bool = False) -> str: - Restart device(s) on the computer specified either by device_id or pattern. Set reboot to True for executing command with conditional reboot

get_hwids(device_id: str = "", pattern: str = "") -> List[DevconHwids]: - Displays the hardware IDs, compatible IDs, and device instance IDs of the specified devices

get_drivernodes(device_id: str = "", pattern: str = "") -> List[DevconDriverNodes]: - Get all driver packages compatible with the device, with version and ranking

get_driverfiles(device_id: str = "", pattern: str = "") -> List[DevconDriverFiles]: - Get full path and file name of installed INF files and device driver files for the specified devices

find_devices(device_id: str = "", pattern: str = "") -> List[DevconDevices]: - List device information for specified devices

listclass(class_name: str) -> List[DevconDevices]: - Lists all devices in the specified device setup classes

get_resources(device_id: str = "", pattern: str = "", resource_filter: str = "all") -> List[DevconResources]: - Get the resources allocated to the specified devices

get_device_id(device_name: str, command: str = "find", class_name: str = "net") -> Union[str, None]: - Get the device instance ID from the specified device name

Data structures

Data structures returned by methods:

class DevconHwids:
    """Structure for devcon hwids."""

    device_pnp: str
    name: str
    hardware_ids: List[str]
    compatible_ids: Optional[List[str]] = None

class DevconDriverNodes:
    """Structure for devcon drivernodes."""

    device_pnp: str
    name: str
    driver_nodes: Optional[dict] = None

class DevconDriverFiles:
    """Structure for devcon driverfiles."""

    device_pnp: str
    name: str
    installed_from: str
    driver_files: List[str]

class DevconDevices:
    """Structure for devcon find and devcon listclass."""

    device_instance_id: str
    device_desc: Optional[str] = ""

class DevconResources:
    """Structure for devcon resources."""

    device_pnp: str
    name: str
    resources: Optional[List[str]] = None

OS supported:

  • WINDOWS

Issue reporting

If you encounter any bugs or have suggestions for improvements, you're welcome to contribute directly or open an issue here.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mfd_devcon-2.0.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file mfd_devcon-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: mfd_devcon-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for mfd_devcon-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 474c7e985e7ad45f27f64ae2aeeab1a17aeddda74a6db77b3a9e4c86d9711542
MD5 e5ba871576f7abd78ceb50f864736190
BLAKE2b-256 40ceeeaa1019c2017f56dfdadb78a128fe02c517e4d806039d7508da6efe0907

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page