package controller import "gitlab.com/beoran/galago/os/linux" import "os" import "unsafe" import "syscall" import "fmt" func Ioctl(file * os.File, code uint32, pointer unsafe.Pointer) error { fmt.Printf("ioctl: %d %d %d\n", uintptr(file.Fd()), uintptr(code), uintptr(pointer)) _, _, errno := syscall.Syscall( syscall.SYS_IOCTL, uintptr(file.Fd()), uintptr(code), uintptr(pointer)) if (errno != 0) { return errno } return nil } func GetDriverVersion(file * os.File) (int32, error) { res := int32(0) data := unsafe.Pointer(&res) err := Ioctl(file, linux.EVIOCGVERSION, data) return res, err }