🛠 Configuring I/O (GPIO, sensors) on PlugMate

TrustKernel PlugMate : Secure Miniature USB-C Computer running PlugOS · avance · Accédez aux interfaces matérielles basses niveau via les drivers virtualisés de PlugOS pour connecter capteurs et périphériques.

Objectives

This advanced tutorial explains how to interact with Input/Output interfaces (GPIO, UART, I2C) on the PlugMate card. Although the device lacks external physical connectors, PlugOS exposes these buses through a secure virtualization layer. The goal is to understand how internal applications communicate with theoretical sensors or development modules connected via a compatible USB-C hub, while respecting the system's strict isolation.

Required Materials

Steps

Connect the PlugMate to the host. Launch the PlugMate client. Once the system boots (approx. 24s), open a terminal on the host and connect via ADB or SSH if enabled in developer settings. ``bash adb shell ``

PlugOS uses specific drivers to expose buses. Check their presence in the virtual filesystem. ``bash ls -l /dev/virtual_gpio* ls -l /dev/virtual_i2c* `` If nodes do not exist, enable developer mode in the host client security settings.

Use the gpioctl utility provided by TrustKernel to export a logical pin. Note that pin numbers correspond to the MediaTek Helio G80 SoC internal mapping table, not external physical pins. ``bash gpioctl export 18 gpioctl set 18 1 ``

To read a sensor connected via a compatible adapter, use i2cget. The address is that of the virtualized device. ``bash i2cget -f -y 2 0x48 0x00 `` This command reads register 0x00 of the device at address 0x48 on bus 2. The encrypted USB-C channel transports these requests to the host if the sensor is physically connected to the host and relayed by the client.

Ensure the system firewall allows access. Sensor data remains isolated from the host. Any attempt to access non-virtualized hardware registers is blocked by the hypervisor.

  1. Connection and Root Access
  2. Verify Virtualized Drivers
  3. Configure GPIO Bus
  4. Read a Sensor via I2C
  5. Security and Isolation

Verification

Run gpioctl get 18 to confirm the pin state. For I2C, verify that the read value matches the simulated or real sensor data. System logs (logcat | grep VirtualIO) should display successful transactions without permission errors.

Further Reading

Explore the PlugOS NDK API to develop native applications interacting with these buses. Note that the duress PIN security erases encryption keys for exchanged data, rendering interception useless. For complex IoT projects, combine this approach with GPS and camera virtualization to create rich, secure input/output contexts.

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials