#!/bin/sh -e MODLIST= MODHDR= [ -x /usr/bin/mar ] [ -x /usr/bin/getpciids ] exit_handler() { local rc=$? trap - EXIT [ -z "$MODLIST" ] || rm -f -- "$MODLIST" [ -z "$MODHDR" ] || rm -f -- "$MODHDR" exit $rc } write_decls() { cat < "$MODLIST" getpciids -f "$MODLIST" |\ while read vendor device subv subd module; do [ -n "$module" ] || module="$subv" echo $module $vendor $device done |sort -u |while read module vendor device; do [ -n "${module##*hci-hcd}" ] || continue printf '\t{ 0x%s, 0x%s, "%s", "%s" },\n' $vendor $device "" $module done cat < "$MODHDR" for marfile in "$@"; do write_typed $marfile >> "$MODHDR" done cat "$MODHDR"