2 # SPDX-License-Identifier: LGPL-2.1
4 [ $# -eq 1 ] && beauty_uapi_linux_dir
=$1 || beauty_uapi_linux_dir
=tools
/perf
/trace
/beauty
/include
/uapi
/linux
/
7 # #define USBDEVFS_CONNINFO_EX(len) _IOC(_IOC_READ, 'U', 32, len)
9 printf "static const char *usbdevfs_ioctl_cmds[] = {\n"
10 regex
="^#[[:space:]]*define[[:space:]]+USBDEVFS_(\w+)(\(\w+\))?[[:space:]]+_IO[CWR]{0,2}\([[:space:]]*(_IOC_\w+,[[:space:]]*)?'U'[[:space:]]*,[[:space:]]*([[:digit:]]+).*"
11 grep -E "$regex" ${beauty_uapi_linux_dir}/usbdevice_fs.h |
grep -E -v 'USBDEVFS_\w+32[[:space:]]' | \
12 sed -r "s/$regex/\4 \1/g" | \
13 sort |
xargs printf "\t[%s] = \"%s\",\n"
16 printf "static const char *usbdevfs_ioctl_32_cmds[] = {\n"
17 regex
="^#[[:space:]]*define[[:space:]]+USBDEVFS_(\w+)[[:space:]]+_IO[WR]{0,2}\([[:space:]]*'U'[[:space:]]*,[[:space:]]*([[:digit:]]+).*"
18 grep -E $regex ${beauty_uapi_linux_dir}/usbdevice_fs.h |
grep -E 'USBDEVFS_\w+32[[:space:]]' | \
19 sed -r "s/$regex/\2 \1/g" | \
20 sort |
xargs printf "\t[%s] = \"%s\",\n"