Пример #1
0
// Testing for support of specific axes can be
// done with the `dev.Supports()` method.
func absAxes(dev *evdev.Device) {
	axes := dev.AbsoluteAxes()
	for n := 0; n < axes.Len(); n++ {
		if !axes.Test(n) {
			continue
		}

		fmt.Printf("  Absolute axis 0x%02x ", n)

		switch n {
		case evdev.AbsX:
			fmt.Printf("X Axis: ")
		case evdev.AbsY:
			fmt.Printf("Y Axis: ")
		case evdev.AbsZ:
			fmt.Printf("Z Axis: ")
		default: // More axes types...
			fmt.Printf("Other axis\n")
		}

		// Get axis information.
		abs := dev.AbsoluteInfo(n)
		fmt.Printf("%+v\n", abs)
	}
}