xref: /haiku/headers/private/shared/usb-utils.h (revision b671e9bbdbd10268a042b4f4cc4317ccd03d105e)
1 /*
2  * Copyright 2008, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  * 	Jérôme Duval
7  */
8 
9 #include <stdio.h>
10 
11 #include "usbdevs.h"
12 #include "usbdevs_data.h"
13 
14 void
15 usb_get_vendor_info(uint16 vendorID, const char **vendorName)
16 {
17 	int i;
18 	for (i = 0; usb_knowndevs[i].vendor != 0; i++) {
19 		if (usb_knowndevs[i].vendor == vendorID) {
20 			*vendorName = usb_knowndevs[i].vendorname;
21 			return;
22 		}
23 	}
24 	*vendorName = NULL;
25 }
26 
27 
28 void
29 usb_get_vendor_device_info(uint16 vendorID, uint16 deviceID, const char **vendorName, const char **deviceName)
30 {
31 	int i;
32 	for (i = 0; usb_knowndevs[i].vendor != 0; i++) {
33 		if (usb_knowndevs[i].vendor == vendorID
34 			&& usb_knowndevs[i].product == deviceID
35 			&& usb_knowndevs[i].flags != USB_KNOWNDEV_NOPROD) {
36 			*deviceName = usb_knowndevs[i].productname;
37 			*vendorName = usb_knowndevs[i].vendorname;
38 			return;
39 		}
40 	}
41 	*vendorName = NULL;
42 	*deviceName = NULL;
43 }
44