- Need to respect the module name and the USB mode when accumulating device ID's.
- Be more verbose on file seek failures. Allow a file size of zero. - Improve the wrapper shell. MFC after: 14 days
This commit is contained in:
parent
4449ead376
commit
c9a6ce0cd8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=223535
@ -28,6 +28,7 @@
|
||||
|
||||
OS=FreeBSD
|
||||
DOLLAR=$
|
||||
OBJCOPY=objcopy
|
||||
|
||||
cat <<EOF
|
||||
#
|
||||
@ -41,6 +42,7 @@ EOF
|
||||
|
||||
rm -f bus_autoconf_format.bin
|
||||
rm -f bus_autoconf_args.txt
|
||||
rm -f bus_autoconf.ids
|
||||
|
||||
for F in $*
|
||||
do
|
||||
@ -48,19 +50,19 @@ do
|
||||
G=$(basename ${F})
|
||||
|
||||
# Format information
|
||||
objcopy -j bus_autoconf_format -O binary ${F} temp.ids 2> /dev/null
|
||||
[ -f temp.ids ] && cat temp.ids >> bus_autoconf_format.bin
|
||||
${OBJCOPY} -j bus_autoconf_format -O binary ${F} bus_autoconf.ids 2> /dev/null
|
||||
[ -f bus_autoconf.ids ] && cat bus_autoconf.ids >> bus_autoconf_format.bin
|
||||
|
||||
# USB Host mode
|
||||
objcopy -j usb_host_id -O binary ${F} "usb_host_id,${G}" 2> /dev/null
|
||||
${OBJCOPY} -j usb_host_id -O binary ${F} "usb_host_id,${G}" 2> /dev/null
|
||||
[ -f "usb_host_id,${G}" ] && (echo -n " -i usb_host_id,${G}" >> bus_autoconf_args.txt)
|
||||
|
||||
# USB Device mode
|
||||
objcopy -j usb_device_id -O binary ${F} "usb_device_id,${G}" 2> /dev/null
|
||||
${OBJCOPY} -j usb_device_id -O binary ${F} "usb_device_id,${G}" 2> /dev/null
|
||||
[ -f "usb_device_id,${G}" ] && (echo -n " -i usb_device_id,${G}" >> bus_autoconf_args.txt)
|
||||
|
||||
# USB Dual mode
|
||||
objcopy -j usb_dual_id -O binary ${F} "usb_dual_id,${G}" 2> /dev/null
|
||||
${OBJCOPY} -j usb_dual_id -O binary ${F} "usb_dual_id,${G}" 2> /dev/null
|
||||
[ -f "usb_dual_id,${G}" ] && (echo -n " -i usb_dual_id,${G}" >> bus_autoconf_args.txt)
|
||||
|
||||
done
|
||||
@ -69,4 +71,8 @@ done
|
||||
bus_autoconf -F bus_autoconf_format.bin $(cat bus_autoconf_args.txt)
|
||||
|
||||
# Cleanup
|
||||
rm -f -- bus_autoconf_format.bin $(cat bus_autoconf_args.txt)
|
||||
rm -f -- \
|
||||
$(cat bus_autoconf_args.txt) \
|
||||
bus_autoconf_args.txt \
|
||||
bus_autoconf_format.bin \
|
||||
bus_autoconf.ids
|
||||
|
@ -48,11 +48,15 @@ load_file(const char *fname, uint8_t **pptr, uint32_t *plen)
|
||||
err(EX_NOINPUT, "Cannot open file '%s'", fname);
|
||||
|
||||
off = lseek(f, 0, SEEK_END);
|
||||
if (off <= 0)
|
||||
err(EX_NOINPUT, "Cannot seek to end of file");
|
||||
if (off < 0) {
|
||||
err(EX_NOINPUT, "Cannot seek to "
|
||||
"end of file '%s'", fname);
|
||||
}
|
||||
|
||||
if (lseek(f, 0, SEEK_SET) < 0)
|
||||
err(EX_NOINPUT, "Cannot seek to beginning of file");
|
||||
if (lseek(f, 0, SEEK_SET) < 0) {
|
||||
err(EX_NOINPUT, "Cannot seek to "
|
||||
"beginning of file '%s'", fname);
|
||||
}
|
||||
|
||||
len = off;
|
||||
if (len != off)
|
||||
|
@ -276,6 +276,10 @@ usb_dump(struct usb_device_id *id, uint32_t nid)
|
||||
break;
|
||||
if (id[n].idVendor != id[0].idVendor)
|
||||
break;
|
||||
if (strcmp(id[n].module_name, id[0].module_name))
|
||||
break;
|
||||
if (strcmp(id[n].module_mode, id[0].module_mode))
|
||||
break;
|
||||
n++;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user