hwscan
A Python CLI tool that detects attached hardware devices on Linux systems. It scans for connected USB devices, storage devices, and host system information, outputting results in JSON format.
Features
Supported Hardware Detection:
- TriLightSense (FTDI devices)
- STLINK-V3 (ST-Link debuggers with attached storage)
- ESP32 (C5 WROOM variant)
- Arduino Leonardo
- JLink (Segger JLink debuggers)
- UART to DMX converters
- Host System Info (hostname, model name, system UUID)
Installation
Prerequisites
- Python 3.8 or higher
- Linux operating system (uses sysfs for device detection)
Install from PyPI
pip install lr-hwscan
Install from source
git clone <repository-url>
cd lr-hwscan
pip install -e ".[dev]"
Usage
Basic Usage
Run the scanner with JSON output:
hwscan
Pretty-print JSON Output
For more readable JSON formatting:
hwscan --pretty
Display Detector Errors
To see any errors encountered during hardware detection:
hwscan --errors
Combined example:
hwscan --pretty --errors
Save Results to File
Save hardware detection results to a JSON file:
hwscan --output hardware.json
Smart Merging: If the file already exists, the tool intelligently merges new detection results with existing data. This preserves any custom fields you've added (like name for device mapping) while updating detected information:
# First run - creates the file
hwscan --output hardware.json
# Later, if device configuration changes, custom fields are preserved
hwscan --output hardware.json
Example: If your hardware.json contains custom mapping data:
{
"3C:DC:75:84:F9:7C": {
"name": "spi-bridge-timo",
"type": "esp32-c5-wroom",
"tty": "/dev/ttyACM0"
}
}
And the tty changes to /dev/ttyACM1, running hwscan --output hardware.json will update the tty while preserving the name field.
Show Version
hwscan --version
Output Format
The tool outputs a JSON object where each key is a unique hardware identifier and the value contains device information.
Example output:
{
"trilightsense_0": {
"vendor": "FTDI",
"product": "TriLightSense",
"serial": "FTDI123456",
"port": "/dev/ttyUSB0"
},
"stlink_0": {
"vendor": "STMicroelectronics",
"product": "STLINK-V3",
"serial": "STL12345678",
"port": "/dev/ttyACM0"
},
"host_system": {
"hostname": "workstation-01",
"model": "Dell Inc.",
"uuid": "550e8400-e29b-41d4-a716-446655440000"
}
}
Use Cases
- Hardware Inventory: Automatically detect and catalog connected devices in labs or production environments
- CI/CD Pipelines: Verify required hardware is available before running CI tests
- Device Management: Track connected debugging and serial devices
- System Integration: Generate hardware resource definitions for automated test systems
Development
Run Tests
make test
Format Code
make black
Build Distribution
make build
Requirements
Runtime Dependencies:
- requests >= 2.32
- typer >= 0.12
- rich >= 13.7
- pydantic >= 2.8
Development Dependencies:
- black >= 25.9.0
- pytest >= 8.4.2
- pytest-html
- pytest-cov
- build >= 1.2.1
- twine >= 5.1.1
License
MIT License - See LICENSE file for details
Support
This tool is intended for internal LumenRadio use. For issues or feature requests, please contact the development team.
Metadata
Release files for lr-hwscan 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lr_hwscan-1.2.0.tar.gz | 22.6 kB | Without provenance | Details for lr_hwscan-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| lr_hwscan-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for lr_hwscan-1.2.0-py3-none-any.whl |
Total release size: 37.6 kB
Release files / lr_hwscan-1.2.0.tar.gz
| Download URL | lr_hwscan-1.2.0.tar.gz |
|---|---|
| Size | 22.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d1975adc69d11b0da87e93a3b049bc49a0402efcbc7593d628b3aa6db4ce2213
|
|
BLAKE2b-256 checksum How to use checksums |
3b0b92f185e781650be367230bb067f4828e7237ed3304fd216e0393fec3a910
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / lr_hwscan-1.2.0-py3-none-any.whl
| Download URL | lr_hwscan-1.2.0-py3-none-any.whl |
|---|---|
| Size | 14.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
30abed00d8c983c22674409d473a220cc4a59b9fa8733a1a344112826b003824
|
|
BLAKE2b-256 checksum How to use checksums |
a469308a42574d5c757a60b1d0b65039da9c46c9450c52e2b1513b18ad2d58ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Security for lr-hwscan 1.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.