# emii31/motorola-udfps-bridge architecture

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

- Interactive diagram: https://gitdiagram.com/emii31/motorola-udfps-bridge
- Repository: https://github.com/emii31/motorola-udfps-bridge

## Overview

This is a Motorola under-display fingerprint (UDFPS) bridge daemon. During an Android biometric session, it watches the configured touch input; finger-down/up events control display LHBM and send corresponding fingerprint events. A watchdog and session-end handling disarm LHBM. Display operation prefers DRM and falls back to sysfs; fingerprint operation selects the Motorola HIDL backend by default, while the AOSP backend is an unimplemented stub. The excerpts show these runtime paths; the README is empty, so broader capabilities are not documented.

Main entry points: [`src/moto_fod_bridge.cpp`](https://github.com/emii31/motorola-udfps-bridge/blob/main/src/moto_fod_bridge.cpp) (FOD bridge daemon), [`src/display/drm_backend.cpp`](https://github.com/emii31/motorola-udfps-bridge/blob/main/src/display/drm_backend.cpp) (DRM backend), [`src/display/sysfs_backend.cpp`](https://github.com/emii31/motorola-udfps-bridge/blob/main/src/display/sysfs_backend.cpp) (Sysfs backend), [`src/fingerprint/motorola_hidl_backend.cpp`](https://github.com/emii31/motorola-udfps-bridge/blob/main/src/fingerprint/motorola_hidl_backend.cpp) (Motorola HIDL backend)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Daemon orchestration"]
  node_fod_daemon["FOD bridge daemon"]
  node_device_config["Device configuration<br/>[device_config.h]"]
end

subgraph group_display["Display control"]
  node_display_api["LHBM interface<br/>[lhbm_backend.h]"]
  node_drm_backend["DRM backend<br/>[drm_backend.cpp]"]
  node_sysfs_backend["Sysfs backend<br/>[sysfs_backend.cpp]"]
end

subgraph group_fingerprint["Fingerprint control"]
  node_fingerprint_api["Fingerprint interface"]
  node_moto_backend["Motorola HIDL backend"]
  node_aosp_backend["AOSP HIDL stub"]
end

node_biometric_logs(("Biometric logs"))
node_touch_input(("Touch input"))
node_display_hw(("Display device"))
node_vendor_service(("Motorola HIDL service"))

node_biometric_logs -->|"streams events"| node_fod_daemon
node_touch_input -->|"provides events"| node_fod_daemon
node_device_config -->|"configures"| node_fod_daemon
node_fod_daemon -->|"initializes first"| node_drm_backend
node_fod_daemon -->|"falls back to"| node_sysfs_backend
node_fod_daemon -->|"selects by config"| node_moto_backend
node_fod_daemon -->|"selects otherwise"| node_aosp_backend
node_drm_backend -->|"implements"| node_display_api
node_sysfs_backend -->|"implements"| node_display_api
node_drm_backend -->|"issues ioctls"| node_display_hw
node_sysfs_backend -->|"writes sysfs"| node_display_hw
node_fod_daemon -->|"sets LHBM state"| node_display_api
node_moto_backend -->|"implements"| node_fingerprint_api
node_aosp_backend -->|"implements"| node_fingerprint_api
node_fod_daemon -->|"sends FOD events"| node_fingerprint_api
node_moto_backend -->|"loads and calls"| node_vendor_service

click node_fod_daemon "https://github.com/emii31/motorola-udfps-bridge/blob/main/src/moto_fod_bridge.cpp"
click node_device_config "https://github.com/emii31/motorola-udfps-bridge/blob/main/include/device_config.h"
click node_display_api "https://github.com/emii31/motorola-udfps-bridge/blob/main/include/lhbm_backend.h"
click node_drm_backend "https://github.com/emii31/motorola-udfps-bridge/blob/main/src/display/drm_backend.cpp"
click node_sysfs_backend "https://github.com/emii31/motorola-udfps-bridge/blob/main/src/display/sysfs_backend.cpp"
click node_fingerprint_api "https://github.com/emii31/motorola-udfps-bridge/blob/main/include/fingerprint_backend.h"
click node_moto_backend "https://github.com/emii31/motorola-udfps-bridge/blob/main/src/fingerprint/motorola_hidl_backend.cpp"
click node_aosp_backend "https://github.com/emii31/motorola-udfps-bridge/blob/main/src/fingerprint/aosp_hidl_backend.cpp"

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_fod_daemon,node_device_config toneBlue
class node_display_api,node_drm_backend,node_sysfs_backend toneAmber
class node_fingerprint_api,node_moto_backend,node_aosp_backend toneMint
class node_biometric_logs,node_touch_input,node_display_hw,node_vendor_service toneIndigo
```

## Components

### Daemon orchestration

- [FOD bridge daemon](https://github.com/emii31/motorola-udfps-bridge/blob/main/src/moto_fod_bridge.cpp): `src/moto_fod_bridge.cpp`
- [Device configuration](https://github.com/emii31/motorola-udfps-bridge/blob/main/include/device_config.h): `include/device_config.h`

### Display control

- [LHBM interface](https://github.com/emii31/motorola-udfps-bridge/blob/main/include/lhbm_backend.h): `include/lhbm_backend.h`
- [DRM backend](https://github.com/emii31/motorola-udfps-bridge/blob/main/src/display/drm_backend.cpp): `src/display/drm_backend.cpp`
- [Sysfs backend](https://github.com/emii31/motorola-udfps-bridge/blob/main/src/display/sysfs_backend.cpp): `src/display/sysfs_backend.cpp`

### Fingerprint control

- [Fingerprint interface](https://github.com/emii31/motorola-udfps-bridge/blob/main/include/fingerprint_backend.h): `include/fingerprint_backend.h`
- [Motorola HIDL backend](https://github.com/emii31/motorola-udfps-bridge/blob/main/src/fingerprint/motorola_hidl_backend.cpp): `src/fingerprint/motorola_hidl_backend.cpp`
- [AOSP HIDL stub](https://github.com/emii31/motorola-udfps-bridge/blob/main/src/fingerprint/aosp_hidl_backend.cpp): `src/fingerprint/aosp_hidl_backend.cpp`

### Other components

- **Biometric logs**
- **Touch input**
- **Display device**
- **Motorola HIDL service**

## Connections

- Biometric logs → FOD bridge daemon: streams events (evidence: `src/moto_fod_bridge.cpp`)
- Touch input → FOD bridge daemon: provides events (evidence: `src/moto_fod_bridge.cpp`)
- Device configuration → FOD bridge daemon: configures (evidence: `src/moto_fod_bridge.cpp`)
- FOD bridge daemon → DRM backend: initializes first (evidence: `src/moto_fod_bridge.cpp`)
- FOD bridge daemon → Sysfs backend: falls back to (evidence: `src/moto_fod_bridge.cpp`)
- FOD bridge daemon → Motorola HIDL backend: selects by config (evidence: `src/moto_fod_bridge.cpp`)
- FOD bridge daemon → AOSP HIDL stub: selects otherwise (evidence: `src/moto_fod_bridge.cpp`)
- DRM backend → LHBM interface: implements (evidence: `src/display/drm_backend.cpp`)
- Sysfs backend → LHBM interface: implements (evidence: `src/display/sysfs_backend.cpp`)
- DRM backend → Display device: issues ioctls (evidence: `src/display/drm_backend.cpp`)
- Sysfs backend → Display device: writes sysfs (evidence: `src/display/sysfs_backend.cpp`)
- FOD bridge daemon → LHBM interface: sets LHBM state (evidence: `src/moto_fod_bridge.cpp`)
- Motorola HIDL backend → Fingerprint interface: implements (evidence: `src/fingerprint/motorola_hidl_backend.cpp`)
- AOSP HIDL stub → Fingerprint interface: implements (evidence: `src/fingerprint/aosp_hidl_backend.cpp`)
- FOD bridge daemon → Fingerprint interface: sends FOD events (evidence: `src/moto_fod_bridge.cpp`)
- Motorola HIDL backend → Motorola HIDL service: loads and calls (evidence: `src/fingerprint/motorola_hidl_backend.cpp`)
