---
title: "USB: Test function"
canonical_url: https://developer.repebble.com/pebbleos/docs/samples/subsys/usb/test/
last_updated: 2026-11-26
sdk_version: 4.44
---
# USB: Test function

Source: https://developer.repebble.com/pebbleos/docs/samples/subsys/usb/test/

This sample runs the USB test function (`CONFIG_USB_TEST`) and nothing else, for the integration tests in `tests/integration/usb`, which drive it from the host the board’s USB device port is connected to. See [USB](https://developer.repebble.com/pebbleos/docs/subsystems/usb.md) for what the function does, and [Integration tests](https://developer.repebble.com/pebbleos/docs/development/tests/integration.md) for running the tests.

Run:

`pbl samples samples/subsys/usb/test`

Boards:

every board

## Sources

src/main.c

```
#include \<stdio.h\>#include \<pbl/usb/usbd.h\>int main(void) {int ret;ret = pbl\_usbd\_enable();if (ret != 0) {fprintf(stderr, "usb: test function failed (%d)\n", ret);return ret;}printf("usb: test function up\n");return 0;}
```

## Output

```
usb: test function up
```

Generated from PebbleOS [9fa910d13](https://github.com/coredevices/pebbleos/commit/9fa910d13ea42053dff926754a25c68090e963dc). This page is maintained in the pebbleos repository: [docs/samples/subsys/usb/test.md](https://github.com/coredevices/pebbleos/blob/9fa910d13ea42053dff926754a25c68090e963dc/docs/samples/subsys/usb/test.md).
