diff --git a/uinput.go b/uinput.go index d469bbe..f28caf9 100644 --- a/uinput.go +++ b/uinput.go @@ -139,7 +139,7 @@ func createUsbDevice(deviceFile *os.File, dev uinputUserDev) (fd *os.File, err e _ = deviceFile.Close() return nil, fmt.Errorf("failed to write user device buffer: %v", err) } - _, err = deviceFile.Write(buf.Bytes()) + err = ioctl(deviceFile, uiDevSetup, uintptr(unsafe.Pointer(buf))) if err != nil { _ = deviceFile.Close() return nil, fmt.Errorf("failed to write uidev struct to device file: %v", err) diff --git a/uinputdefs.go b/uinputdefs.go index a0b367d..2c13632 100644 --- a/uinputdefs.go +++ b/uinputdefs.go @@ -7,6 +7,7 @@ const ( uinputMaxNameSize = 80 uiDevCreate = 0x5501 uiDevDestroy = 0x5502 + uiDevSetup = 0x405c5503 // this is for 64 length buffer to store name // for another length generate using : (len << 16) | 0x8000552C uiGetSysname = 0x8041552c