123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- package linux
- import "fmt"
- func pioc(name string, value uint32) {
- fmt.Printf("%s :%x\n", name, value)
- }
- func ExampleIoctl() {
- pioc("EVIOCGVERSION", EVIOCGVERSION)
- pioc("EVIOCGID", EVIOCGID)
- pioc("EVIOCGNAME(256)", EVIOCGNAME(256))
- pioc("EVIOCGBIT(EV_SYN, 31)", EVIOCGBIT(EV_SYN, 31))
- pioc("EVIOCGBIT(EV_KEY, 767)", EVIOCGBIT(EV_KEY, 767))
- pioc("EVIOCGBIT(EV_ABS, 767)", EVIOCGBIT(EV_ABS, 767))
- pioc("EVIOCGABS(ABS_X)", EVIOCGABS(ABS_X))
- pioc("EVIOCGABS(ABS_Y)", EVIOCGABS(ABS_Y))
- pioc("EVIOCGBIT(EV_MSC, 767)", EVIOCGBIT(EV_MSC, 767))
- pioc("EVIOCGPROP(248)", EVIOCGPROP(248))
- pioc("EVIOCGRAB", EVIOCGRAB)
- pioc("IOC_NONE", IOC_NONE)
- pioc("IOC_WRITE", IOC_WRITE)
- pioc("IOC_READ", IOC_READ)
- pioc("IOC_NRSHIFT", IOC_NRSHIFT)
- pioc("IOC_TYPESHIFT", IOC_TYPESHIFT)
- pioc("IOC_SIZESHIFT", IOC_SIZESHIFT)
- pioc("IOC_DIRSHIFT", IOC_DIRSHIFT)
- pioc("IOC_NRBITS", IOC_NRBITS)
- pioc("IOC_TYPEBITS", IOC_TYPEBITS)
- pioc("IOC_SIZEBITS", IOC_SIZEBITS)
- pioc("IOC_DIRBITS", IOC_DIRBITS)
- /* output:
- EVIOCGVERSION :80044501
- EVIOCGID :80084502
- EVIOCGNAME(256) :81004506
- EVIOCGBIT(EV_SYN, 31) :801f4520
- EVIOCGBIT(EV_KEY, 767) :82ff4521
- EVIOCGBIT(EV_ABS, 767) :82ff4523
- EVIOCGABS(ABS_X) :80184540
- EVIOCGABS(ABS_Y) :80184541
- EVIOCGBIT(EV_MSC, 767) :82ff4524
- EVIOCGPROP(248) :80f84509
- EVIOCGRAB :40044590
- IOC_NONE :0
- IOC_WRITE :1
- IOC_READ :2
- IOC_NRSHIFT :0
- IOC_TYPESHIFT :8
- IOC_SIZESHIFT :10
- IOC_DIRSHIFT :1e
- IOC_NRBITS :8
- IOC_TYPEBITS :8
- IOC_SIZEBITS :e
- IOC_DIRBITS :2
- */
- }
|