Metadata-Version: 2.4
Name: pyusbdisplay
Version: 0.1.2
Summary: Python bindings for MSDisplaySDK USB secondary display
Author: pyusbdisplay contributors
License: MIT AND LicenseRef-MSDisplaySDK-Redistributable
Project-URL: Homepage, https://github.com/example/pyusbdisplay
Keywords: usb,display,msdisplay,ctypes
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: System :: Hardware
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: image
Requires-Dist: Pillow>=10.0.0; extra == "image"
Provides-Extra: monitor
Requires-Dist: Pillow>=10.0.0; extra == "monitor"
Requires-Dist: psutil>=5.9.0; extra == "monitor"
Provides-Extra: dev
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Requires-Dist: wheel; extra == "dev"
Dynamic: license-file

# pyusbdisplay

Python bindings for **MSDisplaySDK** (ctypes + bundled native library).

Wraps the official SDK; does not reimplement the USB protocol.

## Requirements

- Windows or Linux, x86 / x64
- Python 3.10+
- Matching native libs under `msdisplay/_vendor/<platform>/` (wrapper + `libusb0.dll` on Windows)
- Kernel USB driver (`libusb0.sys`) when required — install vendor INF separately; not in the wheel

## Repository layout

```
pyusbdisplay/
  msdisplay/           # installable package (PyPI import name: msdisplay)
    _vendor/           # native libs bundled into wheels
  examples/            # demos
  scripts/             # build_package.py, pack.bat / pack.ps1
  vendor/sdk/          # full official SDK (local only, gitignored)
  sandbox/             # clean venv to test pip install
  pack.bat / pack.ps1  # shims → scripts/pack.*
  pyproject.toml
```

## Setup

```powershell
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -e ".[monitor]"
# or from a built wheel:
pip install dist\pyusbdisplay-*-py3-none-win_amd64.whl
```

Override native library path if needed:

```powershell
$env:MSDISPLAY_SDK_DLL = "C:\path\to\MSDISPLAYSDKWRRAPER.dll"
```

Load order: `MSDISPLAY_SDK_DLL` → `msdisplay/_vendor/<platform>/` → `vendor/sdk/.../Release/` (dev) → cwd.

## Build wheels (one-click)

```powershell
.\pack.bat
.\scripts\pack.ps1 -Clean
python scripts/build_package.py --platforms win_amd64,win32
```

Linux wheels are produced only when `.so` files exist under `msdisplay/_vendor/linux_*`.

```powershell
python -m twine upload dist/*
```

## Demos

```powershell
# verify pip package
cd sandbox
.\run_demo.ps1
.\run_demo.ps1 console --once

# from repo (editable install)
python examples/demo_console.py --once
python examples/demo_adia64.py
```

## Library usage

```python
import msdisplay as msd

msd.load_sdk()
msd.register_callbacks(
    lambda handle, resos: print("attach", hex(handle), resos),
    lambda handle: print("detach", hex(handle)),
)
msd.start()
msd.enable_sdk_screen_processor(True)
print(msd.get_sdk_version())
# ... send_picture / stop ...
```
