You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
518 B
28 lines
518 B
3 years ago
|
#!/bin/sh -eu
|
||
|
#
|
||
|
# usage: gen_pnpids.sh < pnp.ids > pnpids.c
|
||
|
|
||
|
gen_pnps()
|
||
|
{
|
||
|
while read -r id vendor; do
|
||
|
[ "${#id}" = 3 ] || exit 1
|
||
|
|
||
|
printf "\tcase PNP_ID('%c', '%c', '%c'): return \"%s\";\n" \
|
||
|
"$id" "${id#?}" "${id#??}" "$vendor"
|
||
|
done
|
||
|
}
|
||
|
|
||
|
cat << EOF
|
||
|
#include <stdint.h>
|
||
|
#include <stddef.h>
|
||
|
#include "backend/drm/util.h"
|
||
|
#define PNP_ID(a, b, c) ((a & 0x1f) << 10) | ((b & 0x1f) << 5) | (c & 0x1f)
|
||
|
const char *get_pnp_manufacturer(uint16_t code) {
|
||
|
switch (code) {
|
||
|
$(gen_pnps)
|
||
|
}
|
||
|
return NULL;
|
||
|
}
|
||
|
#undef PNP_ID
|
||
|
EOF
|