1 /* 2 * Copyright 2008-2012, 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 10 #include <stdio.h> 11 12 #include "usbhdr.h" 13 14 15 void 16 usb_get_vendor_info(uint16 vendorID, const char **vendorName) 17 { 18 int i; 19 for (i = 0; i < (int)USB_VENTABLE_LEN; i++) { 20 if (UsbVenTable[i].VenId == vendorID) { 21 *vendorName = UsbVenTable[i].VenName && UsbVenTable[i].VenName[0] 22 ? UsbVenTable[i].VenName : NULL; 23 return; 24 } 25 } 26 *vendorName = NULL; 27 } 28 29 30 void 31 usb_get_device_info(uint16 vendorID, uint16 deviceID, const char **deviceName) 32 { 33 int i; 34 // search for the device 35 for (i = 0; i < (int)USB_DEVTABLE_LEN; i++) { 36 if (UsbDevTable[i].VenId == vendorID && UsbDevTable[i].DevId == deviceID ) { 37 *deviceName = UsbDevTable[i].ChipDesc && UsbDevTable[i].ChipDesc[0] 38 ? UsbDevTable[i].ChipDesc : NULL; 39 return; 40 } 41 } 42 *deviceName = NULL; 43 } 44