# wekterian1/hs610-bridge architecture

> Architecture diagram of the GitHub repository wekterian1/hs610-bridge, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wekterian1/hs610-bridge
- Repository: https://github.com/wekterian1/hs610-bridge

## Overview

HS610 Bridge is an Android USB-tablet driver that turns Huion HS610 input into virtual stylus and keyboard events for Krita. The intended workflow is to grant USB and Shizuku access, start the bridge, read and parse tablet reports, map coordinates and pen settings, then emit events through uinput; express keys, touch-ring shortcuts, and the floating bar provide additional controls. README documents these capabilities, but Kotlin sources were not excerpted, so internal wiring among them is shown only as unverified where needed.

Main entry points: [`app/src/main/java/com/example/hs610bridge/BridgeForegroundService.kt`](https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/java/com/example/hs610bridge/BridgeForegroundService.kt) (Bridge Service), [`app/src/main/java/com/example/hs610bridge/MainActivity.kt`](https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/java/com/example/hs610bridge/MainActivity.kt) (Main Screen), [`app/src/main/java/com/example/hs610bridge/Hs610UsbReader.kt`](https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/java/com/example/hs610bridge/Hs610UsbReader.kt) (USB Reader), [`app/src/main/java/com/example/hs610bridge/Hs610Parser.kt`](https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/java/com/example/hs610bridge/Hs610Parser.kt) (Report Parser)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and Controls"]
  node_activity["Main Screen<br/>[MainActivity.kt]"]
  node_service["Bridge Service"]
  node_user_service["Stylus User Service"]
  node_shortcut_overlay["Floating Shortcut Bar"]
  node_shortcut_config["Shortcut Settings<br/>[ShortcutConfig.kt]"]
  node_aidl_service["Stylus IPC Contract"]
end

subgraph group_tablet["Tablet Input"]
  node_usb_reader["USB Reader<br/>[Hs610UsbReader.kt]"]
  node_parser["Report Parser<br/>[Hs610Parser.kt]"]
end

subgraph group_translation["Mapping and Shortcuts"]
  node_mapper["Coordinate Mapper"]
  node_uinput_wrapper["uinput Wrapper<br/>[UinputStylus.kt]"]
end

subgraph group_native["Native Event Output"]
  node_native_probe["Native Probe<br/>[NativeProbe.kt]"]
  node_daemon["uinput Daemon<br/>[uinput_daemon.c]"]
  node_native_stylus["Native Stylus Driver<br/>[uinput_stylus.c]"]
  node_native_stub["Native Probe Stub<br/>[native-lib.cpp]"]
end

node_user(("Tablet User"))
node_shizuku["Shizuku"]
node_krita["Krita"]

node_user -->|"configures and starts"| node_activity
node_activity -.->|"starts bridge"| node_service
node_service -.->|"reads tablet"| node_usb_reader
node_usb_reader -->|"passes reports"| node_parser
node_parser -.->|"maps pen input"| node_mapper
node_mapper -.->|"emits mapped events"| node_uinput_wrapper
node_activity -->|"edits shortcuts"| node_shortcut_config
node_shortcut_overlay -.->|"uses settings"| node_shortcut_config
node_service -->|"launches daemon"| node_shizuku
node_service -->|"streams binary frames"| node_daemon
node_daemon -->|"emits stylus and keys"| node_krita
node_uinput_wrapper -.->|"calls native driver"| node_native_stylus
node_user_service -.->|"uses IPC contract"| node_aidl_service

click node_activity "https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/java/com/example/hs610bridge/MainActivity.kt"
click node_service "https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/java/com/example/hs610bridge/BridgeForegroundService.kt"
click node_user_service "https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/java/com/example/hs610bridge/StylusUserService.kt"
click node_shortcut_overlay "https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/java/com/example/hs610bridge/FloatingShortcutOverlay.kt"
click node_shortcut_config "https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/java/com/example/hs610bridge/ShortcutConfig.kt"
click node_usb_reader "https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/java/com/example/hs610bridge/Hs610UsbReader.kt"
click node_parser "https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/java/com/example/hs610bridge/Hs610Parser.kt"
click node_mapper "https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/java/com/example/hs610bridge/CoordinateMapper.kt"
click node_uinput_wrapper "https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/java/com/example/hs610bridge/UinputStylus.kt"
click node_native_probe "https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/java/com/example/hs610bridge/NativeProbe.kt"
click node_daemon "https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/cpp/uinput_daemon.c"
click node_native_stylus "https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/cpp/uinput_stylus.c"
click node_native_stub "https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/cpp/native-lib.cpp"
click node_aidl_service "https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/aidl/com/example/hs610bridge/IStylusService.aidl"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_activity,node_service,node_user_service,node_shortcut_overlay,node_shortcut_config,node_aidl_service,node_user toneBlue
class node_usb_reader,node_parser toneAmber
class node_mapper,node_uinput_wrapper toneMint
class node_native_probe,node_daemon,node_native_stylus,node_native_stub toneRose
class node_shizuku,node_krita toneIndigo
```

## Components

### App and Controls

- [Main Screen](https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/java/com/example/hs610bridge/MainActivity.kt): `app/src/main/java/com/example/hs610bridge/MainActivity.kt`
- [Bridge Service](https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/java/com/example/hs610bridge/BridgeForegroundService.kt): `app/src/main/java/com/example/hs610bridge/BridgeForegroundService.kt`
- [Stylus User Service](https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/java/com/example/hs610bridge/StylusUserService.kt): `app/src/main/java/com/example/hs610bridge/StylusUserService.kt`
- [Floating Shortcut Bar](https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/java/com/example/hs610bridge/FloatingShortcutOverlay.kt): `app/src/main/java/com/example/hs610bridge/FloatingShortcutOverlay.kt`
- [Shortcut Settings](https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/java/com/example/hs610bridge/ShortcutConfig.kt): `app/src/main/java/com/example/hs610bridge/ShortcutConfig.kt`
- [Stylus IPC Contract](https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/aidl/com/example/hs610bridge/IStylusService.aidl): `app/src/main/aidl/com/example/hs610bridge/IStylusService.aidl`

### Tablet Input

- [USB Reader](https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/java/com/example/hs610bridge/Hs610UsbReader.kt): `app/src/main/java/com/example/hs610bridge/Hs610UsbReader.kt`
- [Report Parser](https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/java/com/example/hs610bridge/Hs610Parser.kt): `app/src/main/java/com/example/hs610bridge/Hs610Parser.kt`

### Mapping and Shortcuts

- [Coordinate Mapper](https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/java/com/example/hs610bridge/CoordinateMapper.kt): `app/src/main/java/com/example/hs610bridge/CoordinateMapper.kt`
- [uinput Wrapper](https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/java/com/example/hs610bridge/UinputStylus.kt): `app/src/main/java/com/example/hs610bridge/UinputStylus.kt`

### Native Event Output

- [Native Probe](https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/java/com/example/hs610bridge/NativeProbe.kt): `app/src/main/java/com/example/hs610bridge/NativeProbe.kt`
- [uinput Daemon](https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/cpp/uinput_daemon.c): `app/src/main/cpp/uinput_daemon.c`
- [Native Stylus Driver](https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/cpp/uinput_stylus.c): `app/src/main/cpp/uinput_stylus.c`
- [Native Probe Stub](https://github.com/wekterian1/hs610-bridge/blob/master/app/src/main/cpp/native-lib.cpp): `app/src/main/cpp/native-lib.cpp`

### Other components

- **Tablet User**
- **Shizuku**
- **Krita**

## Connections

- Tablet User → Main Screen: configures and starts (evidence: `README.md`)
- Main Screen → Bridge Service: starts bridge
- Bridge Service → USB Reader: reads tablet
- USB Reader → Report Parser: passes reports (evidence: `README.md`)
- Report Parser → Coordinate Mapper: maps pen input
- Coordinate Mapper → uinput Wrapper: emits mapped events
- Main Screen → Shortcut Settings: edits shortcuts (evidence: `README.md`)
- Floating Shortcut Bar → Shortcut Settings: uses settings
- Bridge Service → Shizuku: launches daemon (evidence: `README.md`)
- Bridge Service → uinput Daemon: streams binary frames (evidence: `README.md`)
- uinput Daemon → Krita: emits stylus and keys (evidence: `README.md`)
- uinput Wrapper → Native Stylus Driver: calls native driver
- Stylus User Service → Stylus IPC Contract: uses IPC contract
