haiku/headers/private/shared/usb-utils.h
Jérôme Duval d5de4fbb6c helper functions to get device and vendor names from usbdevs list
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28290 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-22 22:32:37 +00:00

44 lines
945 B
C

/*
* Copyright 2008, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Jérôme Duval
*/
#include <stdio.h>
#include "usbdevs.h"
#include "usbdevs_data.h"
void
usb_get_vendor_info(uint16 vendorID, const char **vendorName)
{
int i;
for (i = 0; usb_knowndevs[i].vendor != 0; i++) {
if (usb_knowndevs[i].vendor == vendorID) {
*vendorName = usb_knowndevs[i].vendorname;
return;
}
}
*vendorName = NULL;
}
void
usb_get_vendor_device_info(uint16 vendorID, uint16 deviceID, const char **vendorName, const char **deviceName)
{
int i;
for (i = 0; usb_knowndevs[i].vendor != 0; i++) {
if (usb_knowndevs[i].vendor == vendorID
&& usb_knowndevs[i].product == deviceID
&& usb_knowndevs[i].flags != USB_KNOWNDEV_NOPROD) {
*deviceName = usb_knowndevs[i].productname;
*vendorName = usb_knowndevs[i].vendorname;
return;
}
}
*vendorName = NULL;
*deviceName = NULL;
}