Skip to main content
Version: v1.1

Extend device capabilities

Device capabilities can be extended by attaching and enabling various peripheral devices. AosEdge supports exposing hardware resources to Services in a controlled, declarative, and portable way.

This page explains:

  • How to identify newly added hardware
  • How to declare device access in Unit Config
  • How to update the Target System so AosEdge recognizes the new hardware profile
  • How your Services can access and use the device

These instructions apply to devices such as cameras, audio hardware, GPUs, NPUs, communication adapters, and other peripherals supported by the underlying Linux system.

Types of devices

A peripheral device that extends the system’s capabilities may include:

  • Display / HDMI panels
  • Audio output (ALSA, PulseAudio, etc.)
  • Microphone / audio input
  • Bluetooth adapters
  • GPU / NPU / accelerators
  • Camera modules (V4L2, MIPI, USB cameras)
  • Storage devices (USB, NVMe)
  • Sensors (IMU, GPS, CAN, etc.)

If the hardware is recognized by Linux and exposed under /dev, it can typically be made available to your Service through the AosEdge device configuration mechanism.

Find device path

After physically attaching the peripheral device and ensuring necessary kernel drivers are loaded, confirm the device paths on your target system.

Below are example commands to find the device paths of available devices:

ls /dev
ls -l /dev/video*
ls -l /dev/audio*
lsusb
dmesg

You should identify all device nodes required by the driver or the application.

For example, a USB camera might expose below nodes:

/dev/video0
/dev/video1
/dev/media0

These device paths will later be mapped to your Service.

Add to Unit Config

To expose a peripheral device to a Service, the device should be declared in the Unit Config.

A device entry describes:

  • name - A logical name
  • groups - One or more permission groups
  • hostDevices - The actual host device paths
  • sharedCount - Whether the device may be shared

Example - enabling a camera device:

"devices": [
{
"name": "camera0",
"groups": ["video"],
"hostDevices": [
"/dev/video0",
"/dev/video1",
"/dev/media0"
],
"sharedCount": 1
}
]
note

groups field must match the Linux group that have access to the particular device.

Access the device from your Service

Once the device is exposed into the Service’s runtime environment, your Service can access it using standard Linux APIs or libraries.

Example: V4L2 camera access (pseudocode)

Below example illustrates:

  • Accessing the device named /dev/video0
  • Reading frames through standard I/O operations
int fd = open("/dev/video0", O_RDWR);
if (fd < 0) {
perror("Failed to open device");
return -1;
}

// Configure, read buffers, process frames...