Skip to main content

pyajazz (Ajazz AKP HID Controller)

Python module for interfacing with Ajazz AKP devices (such as the AKP153E Desk Controller), enabling programmatic control over button images, callbacks, and device states.

Table of Contents

Installation

pip install pyajazz
# or
git clone https://github.com/superdeee/pyajazz
cd pyajazz
pip install .

⚠️ Note: This package relies on hidapi. You may need to install OS-specific dependencies before installing cython-hidapi. Refer to the cython-hidapi README for details.

Overview

This module provides an easy-to-use Python interface for controlling Ajazz AKP Devices. pyajazz module is primarily designed for the AKP153E Desk Controller. However, other models such as the AKP05, AKP03, and similar rebranded devices may also work (untested). The module handles all necessary requests, allowing full use of the device without relying on the Chinese OEM software.

❗ Read the usage section carefully to avoid bricking your device!

Features

  • 🧠 Thread-safe read/write handling
  • 🧾 Queue-based events handling
  • 🔧 Easy event callbacks configuration
  • 🧯 Error handling
  • 🧰 Context-managed connection lifecycle

Supported Device Capabilities

  • Device state:
    • Initialize / Shut down
    • Sleep / Wake up
  • Set screen brightness
  • Set/Clear individual icon slots
  • Clear the whole screen
  • Set shutdown logo
  • Button press/release callbacks

Usage

Sample Code

from pyajazz import Device

jpeg_img_data = ... # load JPEG data from file or create image programmatically

with Device() as device:
    device.on_press(position=1, callback=lambda: print("Hello world!"))
    device.set_button_image(position=1, data=jpeg_img_data)

    while True:
        device.handle_pending_inputs()

Setting and Clearing Button Images

When setting button images, JPEG-encoded data must be provided via the data parameter. Images should have dimensions that are multiples of 16 (e.g., 16×N x 16×M) and contain minimal metadata. Ensure metadata is stripped to prevent issues, including possible device bricking. Attempting to set a logo image with extensive metadata (e.g., EXIF) may cause the device to become unresponsive. Always sanitize image files before sending. Images wider/longer than 96 pixels will overflow to adjacent buttons areas.

Note: The AKP153 display controller expects the screen to be rotated 90° clockwise relative to its physical orientation. Therefore, images must be rotated 90° counter-clockwise before sending to the device.

Each screen/button area is referred to as a position, numbered 1–18. The layout for AKP153 device is as follows:

+------+------+------+------+------+----+
|  13  |  10  |  7   |  4   |  1   | 16 |
+------+------+------+------+------+----+
|  14  |  11  |  8   |  5   |  2   | 17 |
+------+------+------+------+------+----+
|  15  |  12  |  9   |  6   |  3   | 18 |
+------+------+------+------+------+----+

Tip: Reading and encoding the images with opencv is a nice way of removing unnecessary metadata

image_data = cv2.imencode('.jpg', image, [int(cv2.IMWRITE_JPEG_QUALITY), 100])

Setting Image

set_button_image(position, data)

  • position (int): ID of the screen area (1–18)
  • data (bytes | bytearray | list[int]): JPEG-encoded image (max ~10kB, no metadata)

Clearing Image

clear_button_image(position)

  • position (int): ID of the screen area (1-18)

Clear All Images

clear_all()

Configuring Button Actions (Callbacks)

The Ajazz AKP153 supports two types of button events - press and release - which can be configured independently. The device does not support key combinations.

Setting Button Press Callback

on_press(position, callback)

  • position (int): ID of the button (1-15)
  • callback (Callable): callable to run on press event

Setting Button Release Callback

on_release(position, callback)

  • position (int): ID of the button (1-15)
  • callback (Callable): callable to run on release event

Remove Callbacks

clear_callbacks(position)

  • position (Optional[int] = None): ID of the button (1-15) or None (clears all button callbacks)

Sleep Mode

The device supports sleep mode in which it handles any USB input requests (button images can be set while asleep). The first user interaction after entering the sleep mode wakes it up, but is not populated to the controlling software.

Entering Sleep Mode

sleep()

Waking Up (through software)

wakeup()

Brightness Control

set_brightness(brightness)

  • brightness (int): brightness level (0-100)

Setting Logo Image

While not connected to any software Ajazz devices display a logo which can be changed with the command below. Note that the display's physical resolution is 854x480, but due to the device's rotation, logo images must be 480x854 (portrait orientation). Make sure any redundant image metadata, such as EXIF, is removed prior to sending!

set_logo_image(data)

  • data (bytes | bytearray | list[int]): JPEG encoded image data with no metadata (512kB maximum)

Logo image can be sanitized with OpenCV using a following snippet:

def prep_logo(path):
    logo_img = cv2.imread(path)
    if logo_img is None:
        raise FileNotFoundError(f"Can't open: {path}")

    if logo_img.shape[0] < logo_img.shape[1]:
        logo_img = cv2.rotate(logo_img, cv2.ROTATE_90_COUNTERCLOCKWISE)
    
    if logo_img.shape != (854, 480, 3):
        print("Logo image resolution must be 854x480, resizing...")
        logo_img = cv2.resize(logo_img, (480, 854))

    success, encoded_image = cv2.imencode('.jpg', logo_img, [int(cv2.IMWRITE_JPEG_QUALITY), 100])

    if not success:
        raise ValueError("Can't encode as JPEG.")
    
    return encoded_image

Metadata

Release files for pyajazz 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyajazz 0.1.1
File Size Uploaded Provenance Actions
pyajazz-0.1.1.tar.gz 12.4 kB Without provenance Details for pyajazz-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyajazz 0.1.1
File Interpreter ABI Platform Actions
pyajazz-0.1.1-py3-none-any.whl Python 3 none any Details for pyajazz-0.1.1-py3-none-any.whl

Total release size: 22.9 kB

Release files / pyajazz-0.1.1.tar.gz

Download URL pyajazz-0.1.1.tar.gz
Size 12.4 kB
Tags Source
SHA-256 checksum
How to use checksums
366c4218db3b88164d0886fc0bf2ab54413333bfc5d9eca418a1fc906f0a90b6
BLAKE2b-256 checksum
How to use checksums
b0220f88644c6246153c857c5ea2a153b673ac9619ba82a891d2e234b54bd123
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Release files / pyajazz-0.1.1-py3-none-any.whl

Download URL pyajazz-0.1.1-py3-none-any.whl
Size 10.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f845a1055d3849f68b8862f33497a02b8fc6ddfcc9d11fe8f6e9b33d9a196e6
BLAKE2b-256 checksum
How to use checksums
9e1fa64448e187e819865833b80c774e9189a702398e85055c240be22e6637da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.11

Security for pyajazz 0.1.1

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page