Giter VIP home page Giter VIP logo

esp32-cdc-keyboard's Introduction

esp-cdc-keyboard

ESP32 USB HID+CDC implementation, it is a composite device that supports HID and CDC on a single USB port.

It recieve messages from the CDC interface, then send back HID reports from the HID interfaces.

The commonly used to simulate keyboard and mouse the hardware way.

Usage

Hardware Required

An ESP32-S3 development board that have USB-OTG supported.

The board has two USB ports, one is USB-OTG, the other is USB-UART(for debugging). Connect both of them to your computer.

Build and Flash

Build the project and flash it to the board, then run monitor tool to view serial output:

idf.py -p PORT flash monitor

Take Control from Host

python example:

def key_report(modifiers: int, keys: List[int]) -> bytes:
    keys += [0] * (6 - len(keys))
    return bytes(
        [0x01, modifiers, 0x00, keys[0], keys[1], keys[2], keys[3], keys[4], keys[5]]
    )

def mouse_report(buttons: int, x: int, y: int) -> bytes:
    return bytes([0x02, buttons, x, y, 0x00, 0x00])

def main():
    ser = serial.serial_for_url("alt://COM1")
    # move mouse relatively to x=20, y=30
    report = mouse_report(0, 20, 30)
    ser.write(report)

esp32-cdc-keyboard's People

Contributors

cnfatal avatar

Stargazers

python_code avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.