On 02.04.2020 02:14, Christos Zoulas wrote: > In article <0fd513f7-6f0c-6ed1-2119-6ce5313d4...@gmx.com>, > Kamil Rytarowski <n...@gmx.com> wrote: >> I propose to add two new tools: >> >> - ioctlname >> - ioctldecode > > I would call it ioctlprint and have: > > ioctlprint [-f <format>] <name>|<expr>|<value> arg.... > > for the input arg can be: > name = TIOCFOO > expr = _IO?('x', y, z) > value = 0xfoobee > > The format can be contain %e %n %v which expand to what you > think and defaults to: > > "%n %e %v\n" > > christos >
I've implemented: ioctlprint [-f format] [-e emul] arg... $ ./ioctlprint 2148554498 2148554498 WSKBDIO_COMPLEXBELL _IOW('W',0x2,0x10) 0x80105702 WSKBDIO_COMPLEXBELL _IOW('W',0x2,0x10) 0x80105702 $ ./ioctlprint -f "%o %d %d %i %x %e %n\n" 2148554498 020004053402 2148554498 2148554498 2148554498 0x80105702 _IOW('W',0x2,0x10) WSKBDIO_COMPLEXBELL %n - name %e - expression %x - print HEX number %o - print OCT number %d %i - print DEC number http://netbsd.org/~kamil/patch-00245-kdump-ioctlname.3.txt