Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #34 from gslandtreter/master
Browse files Browse the repository at this point in the history
Added ioctl UI_DEV_SETUP call before UI_DEV_CREATE
  • Loading branch information
bendahl authored Apr 27, 2023
2 parents fa2027b + 47348ad commit 43336f6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion uinput.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions uinputdefs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 43336f6

Please sign in to comment.