JafarAkhondali / acer-predator-turbo-and-rgb-keyboard-linux-module

Linux kernel module to support Turbo mode and RGB Keyboard for Acer Predator notebook series
GNU General Public License v3.0
358 stars 66 forks source link

[WIP] add support to read buf from driver #13

Open RuiGuilherme opened 2 years ago

RuiGuilherme commented 2 years ago

I "tried" to make a solution, but i'm not C-dev and much less in the low level part...

CHARACTER_DEVICE = "/dev/acer-gkbbl-0"

with open(CHARACTER_DEVICE, 'rb') as cd:
    print(list(cd.read()))

I believe there is a WMID method to get the device settings.

JafarAkhondali commented 2 years ago

Hi, thanks for contribution the method id is: #define ACER_WMID_GET_GAMINGKBBL_METHODID 21

Here is the decompiled info about get and set method for it:


1898   │ #define SetGamingKBBacklight     20
1899   │ typedef struct _SetGamingKBBacklight_IN
1900   │ {
1901   │     // 
1902   │     UCHAR gmInput[16];
1903   │     #define SetGamingKBBacklight_IN_gmInput_SIZE sizeof(UCHAR[16])
1904   │     #define SetGamingKBBacklight_IN_gmInput_ID 1
1905   │ 
1906   │ } SetGamingKBBacklight_IN, *PSetGamingKBBacklight_IN;
1907   │ 
1908   │ #define SetGamingKBBacklight_IN_SIZE (FIELD_OFFSET(SetGamingKBBacklight_IN, gmInput) + SetGamingKBBacklight_IN_gmInput_SIZE)
1909   │ 
1910   │ typedef struct _SetGamingKBBacklight_OUT
1911   │ {
1912   │     // 
1913   │     ULONG gmOutput;
1914   │     #define SetGamingKBBacklight_OUT_gmOutput_SIZE sizeof(ULONG)
1915   │     #define SetGamingKBBacklight_OUT_gmOutput_ID 2
1916   │ 
1917   │ } SetGamingKBBacklight_OUT, *PSetGamingKBBacklight_OUT;
1918   │ 
1919   │ #define SetGamingKBBacklight_OUT_SIZE (FIELD_OFFSET(SetGamingKBBacklight_OUT, gmOutput) + SetGamingKBBacklight_OUT_gmOutput_SIZE)
1920   │ 
1921   │ #define GetGamingKBBacklight     21
1922   │ typedef struct _GetGamingKBBacklight_OUT
1923   │ {
1924   │     // 
1925   │     UCHAR gmReturn;
1926   │     #define GetGamingKBBacklight_OUT_gmReturn_SIZE sizeof(UCHAR)
1927   │     #define GetGamingKBBacklight_OUT_gmReturn_ID 1
1928   │ 
1929   │     // 
1930   │     UCHAR gmOutput[15];
1931   │     #define GetGamingKBBacklight_OUT_gmOutput_SIZE sizeof(UCHAR[15])
1932   │     #define GetGamingKBBacklight_OUT_gmOutput_ID 2
1933   │ 
1934   │ } GetGamingKBBacklight_OUT, *PGetGamingKBBacklight_OUT;
1935   │ 
1936   │ #define GetGamingKBBacklight_OUT_SIZE (FIELD_OFFSET(GetGamingKBBacklight_OUT, gmOutput) + GetGamingKBBacklight_OUT_gmOutput_SIZE)
1937   │ 

Is this what you need?

RuiGuilherme commented 2 years ago

I tried but I could not get the expected state.

image

JafarAkhondali commented 2 years ago

I suggest to try checking function input and output in Windows first. Also de-compiling PredatorSense using Dotpeek may help. WMI Explorer and powershell may come handy for checking it