udev-builtin-hwdb.c revision 33502ffe2eb7b56cdd018a4fb6830d7828519fad
/*
*
* Copyright (C) 2009 Lennart Poettering <lennart@poettering.net>
* Copyright (C) 2011 Kay Sievers <kay.sievers@vrfy.org>
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdlib.h>
#include "udev.h"
static int get_id_attr(
struct udev_device *parent,
const char *name,
const char *t;
unsigned u;
return -1;
}
if (startswith(t, "0x"))
t += 2;
return -1;
}
return 0;
}
static int get_vid_pid(
struct udev_device *parent,
const char *vendor_attr,
const char *product_attr,
return -1;
else if (*vid <= 0) {
return -1;
}
return -1;
return 0;
}
static void rstrip(char *n) {
size_t i;
n[i-1] = 0;
}
#define HEXCHARS "0123456789abcdefABCDEF"
#define WHITESPACE " \t\n\r"
static int lookup_vid_pid(const char *database,
{
FILE *f;
int ret = -1;
int found_vendor = 0;
return -1;
}
for (;;) {
size_t n;
break;
continue;
unsigned u;
if (found_vendor)
break;
char *t;
t = line+4;
t += strspn(t, WHITESPACE);
goto finish;
}
found_vendor = 1;
}
continue;
}
unsigned u;
char *t;
t = line+5;
t += strspn(t, WHITESPACE);
goto finish;
}
break;
}
}
}
ret = 0;
fclose(f);
if (ret < 0) {
}
return ret;
}
static struct udev_device *find_device(struct udev_device *dev, const char *subsys, const char *devtype)
{
const char *str;
goto try_parent;
goto try_parent;
goto try_parent;
goto try_parent;
}
return dev;
}
const char *database,
const char *vendor_attr, const char *product_attr,
{
struct udev_device *parent;
if (!parent) {
goto finish;
}
goto finish;
goto finish;
if (vendor)
if (product)
return 0;
}
{
}
{
}
const struct udev_builtin udev_builtin_usb_db = {
.name = "usb-db",
.cmd = builtin_usb_db,
.run_once = true,
};
const struct udev_builtin udev_builtin_pci_db = {
.name = "pci-db",
.cmd = builtin_pci_db,
.run_once = true,
};