event_to_string_linux.go 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. package linux
  2. import "fmt"
  3. func EventTypeToString(e uint) string {
  4. switch e {
  5. case EV_SYN: return "EV_SYN"
  6. case EV_KEY: return "EV_KEY"
  7. case EV_REL: return "EV_REL"
  8. case EV_ABS: return "EV_ABS"
  9. case EV_MSC: return "EV_MSC"
  10. case EV_SW : return "EV_SW"
  11. case EV_LED: return "EV_LED"
  12. case EV_SND: return "EV_SND"
  13. case EV_REP: return "EV_REP"
  14. case EV_FF : return "EV_FF"
  15. case EV_PWR: return "EV_PWR"
  16. case EV_FF_STATUS: return "EV_FF_STATUS"
  17. case EV_MAX: return "EV_MAX"
  18. case EV_CNT: return "EV_CNT"
  19. default: return fmt.Sprintf("Unknown event %d", e)
  20. }
  21. }
  22. func AbsToString(e uint) string {
  23. switch e {
  24. case ABS_X: return "ABS_X"
  25. case ABS_Y: return "ABS_Y"
  26. case ABS_Z: return "ABS_Z"
  27. case ABS_RX: return "ABS_RX"
  28. case ABS_RY: return "ABS_RY"
  29. case ABS_RZ: return "ABS_RZ"
  30. case ABS_THROTTLE: return "ABS_THROTTLE"
  31. case ABS_RUDDER: return "ABS_RUDDER"
  32. case ABS_WHEEL: return "ABS_WHEEL"
  33. case ABS_GAS: return "ABS_GAS"
  34. case ABS_BRAKE: return "ABS_BRAKE"
  35. case ABS_HAT0X: return "ABS_HAT0X"
  36. case ABS_HAT0Y: return "ABS_HAT0Y"
  37. case ABS_HAT1X: return "ABS_HAT1X"
  38. case ABS_HAT1Y: return "ABS_HAT1Y"
  39. case ABS_HAT2X: return "ABS_HAT2X"
  40. case ABS_HAT2Y: return "ABS_HAT2Y"
  41. case ABS_HAT3X: return "ABS_HAT3X"
  42. case ABS_HAT3Y: return "ABS_HAT3Y"
  43. case ABS_PRESSURE: return "ABS_PRESSURE"
  44. case ABS_DISTANCE: return "ABS_DISTANCE"
  45. case ABS_TILT_X: return "ABS_TILT_X"
  46. case ABS_TILT_Y: return "ABS_TILT_Y"
  47. case ABS_TOOL_WIDTH: return "ABS_TOOL_WIDTH"
  48. case ABS_VOLUME: return "ABS_VOLUME"
  49. case ABS_MISC: return "ABS_MISC"
  50. case ABS_MT_SLOT: return "ABS_MT_SLOT"
  51. case ABS_MT_TOUCH_MAJOR: return "ABS_MT_TOUCH_MAJOR"
  52. case ABS_MT_TOUCH_MINOR: return "ABS_MT_TOUCH_MINOR"
  53. case ABS_MT_WIDTH_MAJOR: return "ABS_MT_WIDTH_MAJOR"
  54. case ABS_MT_WIDTH_MINOR: return "ABS_MT_WIDTH_MINOR"
  55. case ABS_MT_ORIENTATION: return "ABS_MT_ORIENTATION"
  56. case ABS_MT_POSITION_X: return "ABS_MT_POSITION_X"
  57. case ABS_MT_POSITION_Y: return "ABS_MT_POSITION_Y"
  58. case ABS_MT_TOOL_TYPE: return "ABS_MT_TOOL_TYPE"
  59. case ABS_MT_BLOB_ID: return "ABS_MT_BLOB_ID"
  60. case ABS_MT_TRACKING_ID: return "ABS_MT_TRACKING_ID"
  61. case ABS_MT_PRESSURE: return "ABS_MT_PRESSURE"
  62. case ABS_MT_DISTANCE: return "ABS_MT_DISTANCE"
  63. case ABS_MT_TOOL_X: return "ABS_MT_TOOL_X"
  64. case ABS_MT_TOOL_Y: return "ABS_MT_TOOL_Y"
  65. case ABS_MAX: return "ABS_MAX"
  66. case ABS_CNT: return "ABS_CNT"
  67. default: return fmt.Sprintf("Unknown absolute axis %d", e)
  68. }
  69. }