Back to home page

OSCL-LXR

 
 

    


0001 #!/bin/sh
0002 # SPDX-License-Identifier: LGPL-2.1
0003 
0004 [ $# -eq 1 ] && header_dir=$1 || header_dir=tools/include/uapi/linux/
0005 
0006 # also as:
0007 # #define USBDEVFS_CONNINFO_EX(len)  _IOC(_IOC_READ, 'U', 32, len)
0008 
0009 printf "static const char *usbdevfs_ioctl_cmds[] = {\n"
0010 regex="^#[[:space:]]*define[[:space:]]+USBDEVFS_(\w+)(\(\w+\))?[[:space:]]+_IO[CWR]{0,2}\([[:space:]]*(_IOC_\w+,[[:space:]]*)?'U'[[:space:]]*,[[:space:]]*([[:digit:]]+).*"
0011 egrep "$regex" ${header_dir}/usbdevice_fs.h | egrep -v 'USBDEVFS_\w+32[[:space:]]' | \
0012         sed -r "s/$regex/\4 \1/g"       | \
0013         sort | xargs printf "\t[%s] = \"%s\",\n"
0014 printf "};\n\n"
0015 printf "#if 0\n"
0016 printf "static const char *usbdevfs_ioctl_32_cmds[] = {\n"
0017 regex="^#[[:space:]]*define[[:space:]]+USBDEVFS_(\w+)[[:space:]]+_IO[WR]{0,2}\([[:space:]]*'U'[[:space:]]*,[[:space:]]*([[:digit:]]+).*"
0018 egrep $regex ${header_dir}/usbdevice_fs.h | egrep 'USBDEVFS_\w+32[[:space:]]' | \
0019         sed -r "s/$regex/\2 \1/g"       | \
0020         sort | xargs printf "\t[%s] = \"%s\",\n"
0021 printf "};\n"
0022 printf "#endif\n"