]>
Commit | Line | Data |
---|---|---|
32c4d2ba ZJS |
1 | #include <stdio.h> |
2 | #include <stdint.h> | |
3 | #include <sd-hwdb.h> | |
4 | ||
5 | int print_usb_properties(uint16_t vid, uint16_t pid) { | |
6 | char match[15]; | |
7 | sd_hwdb *hwdb; | |
8 | const char *key, *value; | |
9 | int r; | |
10 | ||
11 | /* Match this USB vendor and product ID combination */ | |
12 | snprintf(match, sizeof match, "usb:v%04Xp%04X", vid, pid); | |
13 | ||
14 | r = sd_hwdb_new(&hwdb); | |
15 | if (r < 0) | |
16 | return r; | |
17 | ||
18 | SD_HWDB_FOREACH_PROPERTY(hwdb, match, key, value) | |
19 | printf("%s: \"%s\" → \"%s\"\n", match, key, value); | |
20 | ||
21 | sd_hwdb_unref(hwdb); | |
22 | return 0; | |
23 | } | |
24 | ||
25 | int main(int argc, char **argv) { | |
26 | print_usb_properties(0x046D, 0xC534); | |
27 | return 0; | |
28 | } |