# fliggibish/undercontroldualshock3 architecture

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

- Interactive diagram: https://gitdiagram.com/fliggibish/undercontroldualshock3
- Repository: https://github.com/fliggibish/undercontroldualshock3

## Overview

This repository is an experimental Linux kernel module for Under Control DualShock 3 controllers over Bluetooth. The workflow is: pair the controller, let the Linux L2CAP stack handle its connection, and use module-installed inspectors to adapt incoming signaling packets and filter outgoing HID reports. The README also identifies a required kernel patch; its implementation is not shown here, so its role is limited to enabling the integration. The sampled source shows packet handling and hook registration, but not the patch’s internals.

Main entry points: [`module.c`](https://github.com/fliggibish/undercontroldualshock3/blob/master/module.c) (Receive adaptation), [`kernel_patch.diff`](https://github.com/fliggibish/undercontroldualshock3/blob/master/kernel_patch.diff) (Inspector patch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_kernel["Kernel integration"]
  node_l2cap["Linux L2CAP"]
  node_kernel_patch["Inspector patch<br/>[kernel_patch.diff]"]
  node_module["uc_ds3 module<br/>[module.c]"]
end

subgraph group_packets["Packet handling"]
  node_recv["Receive adaptation<br/>[module.c]"]
  node_send["Output filtering<br/>[module.c]"]
end

node_controller(("DS3 controller"))

node_controller -->|"sends Bluetooth packets"| node_l2cap
node_kernel_patch -->|"enables inspectors"| node_l2cap
node_module -->|"registers hooks"| node_l2cap
node_l2cap -->|"dispatches received packets"| node_recv
node_l2cap -->|"dispatches outgoing packets"| node_send
node_recv -->|"rewrites signaling"| node_l2cap
node_send -->|"filters output reports"| node_controller

click node_kernel_patch "https://github.com/fliggibish/undercontroldualshock3/blob/master/kernel_patch.diff"
click node_module "https://github.com/fliggibish/undercontroldualshock3/blob/master/module.c"
click node_recv "https://github.com/fliggibish/undercontroldualshock3/blob/master/module.c"
click node_send "https://github.com/fliggibish/undercontroldualshock3/blob/master/module.c"

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_l2cap,node_kernel_patch,node_module toneBlue
class node_recv,node_send toneAmber
class node_controller toneIndigo
```

## Components

### Kernel integration

- **Linux L2CAP**
- [Inspector patch](https://github.com/fliggibish/undercontroldualshock3/blob/master/kernel_patch.diff): `kernel_patch.diff`
- [uc_ds3 module](https://github.com/fliggibish/undercontroldualshock3/blob/master/module.c): `module.c`

### Packet handling

- [Receive adaptation](https://github.com/fliggibish/undercontroldualshock3/blob/master/module.c): `module.c`
- [Output filtering](https://github.com/fliggibish/undercontroldualshock3/blob/master/module.c): `module.c`

### Other components

- **DS3 controller**

## Connections

- DS3 controller → Linux L2CAP: sends Bluetooth packets (evidence: `readme.md`)
- Inspector patch → Linux L2CAP: enables inspectors (evidence: `readme.md`)
- uc_ds3 module → Linux L2CAP: registers hooks (evidence: `module.c`)
- Linux L2CAP → Receive adaptation: dispatches received packets (evidence: `module.c`)
- Linux L2CAP → Output filtering: dispatches outgoing packets (evidence: `module.c`)
- Receive adaptation → Linux L2CAP: rewrites signaling (evidence: `module.c`)
- Output filtering → DS3 controller: filters output reports (evidence: `module.c`)
