ioctl_linux_test.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package linux
  2. import "fmt"
  3. func pioc(name string, value uint32) {
  4. fmt.Printf("%s :%x\n", name, value)
  5. }
  6. func ExampleIoctl() {
  7. pioc("EVIOCGVERSION", EVIOCGVERSION)
  8. pioc("EVIOCGID", EVIOCGID)
  9. pioc("EVIOCGNAME(256)", EVIOCGNAME(256))
  10. pioc("EVIOCGBIT(EV_SYN, 31)", EVIOCGBIT(EV_SYN, 31))
  11. pioc("EVIOCGBIT(EV_KEY, 767)", EVIOCGBIT(EV_KEY, 767))
  12. pioc("EVIOCGBIT(EV_ABS, 767)", EVIOCGBIT(EV_ABS, 767))
  13. pioc("EVIOCGABS(ABS_X)", EVIOCGABS(ABS_X))
  14. pioc("EVIOCGABS(ABS_Y)", EVIOCGABS(ABS_Y))
  15. pioc("EVIOCGBIT(EV_MSC, 767)", EVIOCGBIT(EV_MSC, 767))
  16. pioc("EVIOCGPROP(248)", EVIOCGPROP(248))
  17. pioc("EVIOCGRAB", EVIOCGRAB)
  18. pioc("IOC_NONE", IOC_NONE)
  19. pioc("IOC_WRITE", IOC_WRITE)
  20. pioc("IOC_READ", IOC_READ)
  21. pioc("IOC_NRSHIFT", IOC_NRSHIFT)
  22. pioc("IOC_TYPESHIFT", IOC_TYPESHIFT)
  23. pioc("IOC_SIZESHIFT", IOC_SIZESHIFT)
  24. pioc("IOC_DIRSHIFT", IOC_DIRSHIFT)
  25. pioc("IOC_NRBITS", IOC_NRBITS)
  26. pioc("IOC_TYPEBITS", IOC_TYPEBITS)
  27. pioc("IOC_SIZEBITS", IOC_SIZEBITS)
  28. pioc("IOC_DIRBITS", IOC_DIRBITS)
  29. /* output:
  30. EVIOCGVERSION :80044501
  31. EVIOCGID :80084502
  32. EVIOCGNAME(256) :81004506
  33. EVIOCGBIT(EV_SYN, 31) :801f4520
  34. EVIOCGBIT(EV_KEY, 767) :82ff4521
  35. EVIOCGBIT(EV_ABS, 767) :82ff4523
  36. EVIOCGABS(ABS_X) :80184540
  37. EVIOCGABS(ABS_Y) :80184541
  38. EVIOCGBIT(EV_MSC, 767) :82ff4524
  39. EVIOCGPROP(248) :80f84509
  40. EVIOCGRAB :40044590
  41. IOC_NONE :0
  42. IOC_WRITE :1
  43. IOC_READ :2
  44. IOC_NRSHIFT :0
  45. IOC_TYPESHIFT :8
  46. IOC_SIZESHIFT :10
  47. IOC_DIRSHIFT :1e
  48. IOC_NRBITS :8
  49. IOC_TYPEBITS :8
  50. IOC_SIZEBITS :e
  51. IOC_DIRBITS :2
  52. */
  53. }