]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/hwdb-usb-device.c
systemctl: do not fall back to StartUnit automatically for sleep operations
[thirdparty/systemd.git] / man / hwdb-usb-device.c
CommitLineData
1fe6d37e 1/* SPDX-License-Identifier: MIT-0 */
f4d74c61 2
040cb664 3#define _GNU_SOURCE 1
32c4d2ba
ZJS
4#include <stdio.h>
5#include <stdint.h>
2548ce6a 6#include <systemd/sd-hwdb.h>
32c4d2ba
ZJS
7
8int print_usb_properties(uint16_t vid, uint16_t pid) {
06d0dcc0 9 char match[128];
32c4d2ba
ZJS
10 sd_hwdb *hwdb;
11 const char *key, *value;
12 int r;
13
14 /* Match this USB vendor and product ID combination */
06d0dcc0 15 snprintf(match, sizeof match, "usb:v%04Xp%04X", vid, pid);
32c4d2ba
ZJS
16
17 r = sd_hwdb_new(&hwdb);
18 if (r < 0)
19 return r;
20
21 SD_HWDB_FOREACH_PROPERTY(hwdb, match, key, value)
22 printf("%s: \"%s\" → \"%s\"\n", match, key, value);
23
24 sd_hwdb_unref(hwdb);
25 return 0;
26}
27
28int main(int argc, char **argv) {
29 print_usb_properties(0x046D, 0xC534);
30 return 0;
31}