used your code as follow , also include a print result
Public Sub File_read()
Dim ev As New Input_event
Dim rd As Integer
rd = read_C(kfl.Handle, ev, Object.SizeOf(ev))
Print "ev: "; Str$(ev); " , sizeof ev: "; Object.SizeOf(ev); " , rd: "; rd; " ,time: "; ev.time_.tv_sec; " , type: "; ev.type; " , code: "; ev.code ; " , value: "; ev.value
End
- output print gambas program code in quote
ev: (input_event 0x187abb4) , sizeof ev: 24 , rd: 16 ,time: 1177329438085223 , type: 0 , code: 0 , value: 0
ev: (input_event 0x187abb4) , sizeof ev: 24 , rd: 16 ,time: 1177329438085223 , type: 0 , code: 0 , value: 0
ev: (input_event 0x187abb4) , sizeof ev: 24 , rd: 16 ,time: 1177329438085223 , type: 0 , code: 0 , value: 0
ev: (input_event 0x187abb4) , sizeof ev: 24 , rd: 16 ,time: 1589663478370407 , type: 0 , code: 0 , value: 0
ev: (input_event 0x187abb4) , sizeof ev: 24 , rd: 16 ,time: 1589663478370407 , type: 0 , code: 0 , value: 0
ev: (input_event 0x187abb4) , sizeof ev: 24 , rd: 16 ,time: 1589663478370407 , type: 0 , code: 0 , value: 0
===========================================================================================================
evtest output in terminal from same keyboard and same pressed key (not at same moment -time difference)
Event: time 1592844255.880822, type 4 (EV_MSC), code 4 (MSC_SCAN), value 7005d
Event: time 1592844255.880822, type 1 (EV_KEY), code 76 (KEY_KP5), value 1
Event: time 1592844255.880822, -------------- SYN_REPORT ------------
5Event: time 1592844255.920823, type 4 (EV_MSC), code 4 (MSC_SCAN), value 7005d
Event: time 1592844255.920823, type 1 (EV_KEY), code 76 (KEY_KP5), value 0
Event: time 1592844255.920823, -------------- SYN_REPORT ------------
I believe the time are the first 16 bytes and the following 8 contain the keypressed type, value, code .
Do I only get 16 bytes as rd=16 ?
The sizeof ev is correct =24.
The number of lines produced by a keypress (5) is the samefor evtest and file_read
- so the third line and sixth lines (evtest - SYN_REPORT ) should give 0 values.
Do I have to read - approach- the ev.code on another way, i am stuck, can't still a good grip on it.
The implemented code for keyboard_name returns empty string and grab with iotcl still returns -1 .
What am I doing wrong.
Thanks a lot for your code it helps to evolve.
Greetings