Skip to main content

pych9329

Python module to control ch9329

Installation

You can install the package via pip:

pip install pych9329

Usage

Quick start

import time

from serial import Serial

from pych9329 import chip_command
from pych9329 import keyboard
from pych9329 import mouse


def main():
    ser = Serial("COM10", 9600, timeout=0.5)

    # Receive the keyboard lock status
    result, kb_status = keyboard.receive_indicator_status(ser)
    if result:
        # {'usb_connect_status': True, 'num_lock': True, 'caps_lock': False, 'scroll_lock': False}
        print(kb_status)
        # Automatically turn off caps_lock
        if kb_status["caps_lock"]:
            keyboard.click(ser, "caps_lock")

    # Click the "Win + D" key combination
    # First press the 2 buttons at the same time
    # For optional parameters of modifiers, please refer to keyboard.MODIFIER_KEY_NAME_MAP
    keyboard.trigger(ser, ["D"], ["win"])
    # Usually there is a 10 millisecond interval between pressing a key and popping it up.
    # Simulate this behavior with sleep
    time.sleep(0.1)
    # Pop up all keys
    keyboard.trigger(ser, [""], [""])

    # Click a single key
    keyboard.click(ser, "a")
    keyboard.click(ser, "A")
    # Send text
    keyboard.send_text(ser, "\n")
    keyboard.send_text(ser, "Hello World\n")
    keyboard.send_text(ser, "abcdefghijklmnopqrstuvwxyz\n")
    keyboard.send_text(ser, "ABCDEFGHIJKLMNOPQRSTUVWXYZ\n")
    keyboard.send_text(ser, "0123456789\n")
    keyboard.send_text(ser, "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~\n")

    # Move the mouse
    mouse.move(ser, x=500, y=500)
    mouse.move(ser, x=50, y=50, relative_mode=True)
    # Click a button
    # For supported key names, please see mouse.MOUSE_BUTTON_NAME_MAP
    mouse.click(ser, button_name="left")

    # 2019A152BB40
    print(chip_command.get_serial_number(ser))
    # WCH UART TO KB-MS_V1.8
    print(chip_command.get_product(ser))
    # WWW.WCH.CN
    print(chip_command.get_manufacturer(ser))

    ser.close()


if __name__ == "__main__":
    main()

Example

More example please check the example directory.

License

MIT license.

Contributing

This project is modified from ch9329 library.

Thanks to the original author of the ch9329 library Pradish Bijukchhe

Metadata

Release files for pych9329 0.1.7

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

Source distribution (sdist)

Source distribution for pych9329 0.1.7
File Size Uploaded Provenance
pych9329-0.1.7.tar.gz 35.8 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 48.8 kB

Release files / pych9329-0.1.7.tar.gz

Download URL pych9329-0.1.7.tar.gz
Size 35.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8942990a5d0a094093396be5e42711bd327aeb48c8fec72555777a1371a87edb
BLAKE2b-256 checksum
How to use checksums
743e8013dc8f8737597680354391083b30160cddf3981315ef30ce2d56018beb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / pych9329-0.1.7-py3-none-any.whl

Download URL pych9329-0.1.7-py3-none-any.whl
Size 13.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4046ceb0b81604f0a44a416d8085aa6367963cba8076eb606bdab52eba73c34b
BLAKE2b-256 checksum
How to use checksums
d9f2a29d3a80d047da317925fc94008c438bb4b75ab6da4a5031bef15a4aa7e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for pych9329 0.1.7

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.

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