joshuagrisham / samsung-galaxybook-extras

Samsung Galaxybook Linux platform driver and accompanying utilities.
116 stars 15 forks source link

Issues Installing on Galaxy Book Pro 360 - Zorin OS 17.1 #15

Open bryan977 opened 4 months ago

bryan977 commented 4 months ago

I am trying to figure out why I receive the error below when trying to load the module. I am running Zorin OS 17.1 (an Ubuntu derivative).

$ uname -r
6.5.0-41-generic

Error when running modprobe:

$ sudo modprobe samsung-galaxybook
modprobe: ERROR: could not insert 'samsung_galaxybook': Key was rejected by service

My build and install process:

$ ls -la
total 46
drwxrwxr-x 2 bryan bryan     6 Jun 23 10:25 .
drwxrwxr-x 6 bryan bryan     9 Jun 21 15:21 ..
-rw-rw-r-- 1 bryan bryan   388 Jun 21 15:21 Makefile
-rw-rw-r-- 1 bryan bryan     0 Jun 23 08:57 md
-rw-rw-r-- 1 bryan bryan  1255 Jun 21 15:21 README.md
-rw-rw-r-- 1 bryan bryan 40999 Jun 21 15:21 samsung-galaxybook.c

$ make -C /lib/modules/`uname -r`/build M=$PWD
make: Entering directory '/usr/src/linux-headers-6.5.0-41-generic'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: x86_64-linux-gnu-gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
  You are using:           gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
  CC [M]  /home/bryan/Documents/git/samsung-galaxybook-extras/driver/samsung-galaxybook.o
  MODPOST /home/bryan/Documents/git/samsung-galaxybook-extras/driver/Module.symvers
  CC [M]  /home/bryan/Documents/git/samsung-galaxybook-extras/driver/samsung-galaxybook.mod.o
  LD [M]  /home/bryan/Documents/git/samsung-galaxybook-extras/driver/samsung-galaxybook.ko
  BTF [M] /home/bryan/Documents/git/samsung-galaxybook-extras/driver/samsung-galaxybook.ko
Skipping BTF generation for /home/bryan/Documents/git/samsung-galaxybook-extras/driver/samsung-galaxybook.ko due to unavailability of vmlinux
make: Leaving directory '/usr/src/linux-headers-6.5.0-41-generic'

$ sudo /usr/src/linux-source-6.5.0/debian/scripts/sign-module sha512 /usr/src/linux-source-6.5.0/debian/certs/signing_key.pem /usr/src/linux-source-6.5.0/debian/certs/signing_key.x509 /lib/modules/6.5.0-41-generic/updates/samsung-galaxybook.ko

$ sudo make -C /lib/modules/`uname -r`/build M=$PWD modules_install
make: Entering directory '/usr/src/linux-headers-6.5.0-41-generic'
  INSTALL /lib/modules/6.5.0-41-generic/updates/samsung-galaxybook.ko
  SIGN    /lib/modules/6.5.0-41-generic/updates/samsung-galaxybook.ko
  DEPMOD  /lib/modules/6.5.0-41-generic
Warning: modules_install: missing 'System.map' file. Skipping depmod.
make: Leaving directory '/usr/src/linux-headers-6.5.0-41-generic'

$ sudo cp samsung-galaxybook.ko /lib/modules/6.5.0-41-generic/updates

$ sudo depmod

$ sudo sudo modprobe samsung-galaxybook
modprobe: ERROR: could not insert 'samsung_galaxybook': Key was rejected by service

Any help is MUCH appreciated!

mhagnumdw commented 4 months ago

I think you are signing the driver and placing it directly in the final location (sign-module line) and later you copy overwriting what I think is the unsigned driver.

I also think that using uname -r reduces the chance of errors.

I'll give you my exact sequence of commands. Here I use Fedora.

git clone git@github.com:joshuagrisham/samsung-galaxybook-extras.git

cd samsung-galaxybook-extras

cd driver

# it makes sense if you just did a git pull and want to start from scratch
git clean -fdx

git status

make -C /lib/modules/`uname -r`/build M=$PWD

# If UEFI is enabled with Secure Boot, you need to sign the driver
# HERE YOU NEED TO ADJUST FOR YOUR DISTRO
sudo /usr/src/kernels/$(uname -r)/scripts/sign-file \
  sha256 \
  /etc/pki/akmods/private/private_key.priv \
  /etc/pki/akmods/certs/public_key.der \
  samsung-galaxybook.ko

ls -lrtha

sudo make -C /lib/modules/`uname -r`/build M=$PWD modules_install

sudo depmod

# enable the driver
sudo modprobe -v samsung-galaxybook

# check if the driver has been loaded
lsmod | grep samsung_galaxybook
bryan977 commented 4 months ago

@mhagnumdw Thank you. I did get the driver to load last night; however, just haven't had time to post the steps. That said, the keyboard backlight still isn't working so I still have work to do. This is a Galaxy Book Pro 360 (not v2 or v3) so maybe this driver doesn't support it.

$ lsmod | grep samsung_galaxybook
samsung_galaxybook     24576  0
platform_profile       12288  1 samsung_galaxybook
wmi                    40960  3 video,samsung_galaxybook,wmi_bmof
bryan977 commented 4 months ago

Problems I am still having:

  1. Module does not stay loaded after reboot.
  2. The keyboard backlight still does not light nor does Fn+F9 have an affect.

Any help or suggestions is appreciated. Thank you!

bryan977 commented 4 months ago

Any idea how to fix the missing System.map file error?

$ sudo make -C /lib/modules/`uname -r`/build M=$PWD modules_install
make: Entering directory '/usr/src/linux-headers-6.5.0-41-generic'
  INSTALL /lib/modules/6.5.0-41-generic/updates/samsung-galaxybook.ko
  SIGN    /lib/modules/6.5.0-41-generic/updates/samsung-galaxybook.ko
  DEPMOD  /lib/modules/6.5.0-41-generic
Warning: modules_install: missing 'System.map' file. Skipping depmod.
make: Leaving directory '/usr/src/linux-headers-6.5.0-41-generic'
bryan977 commented 4 months ago

It does appear the driver is loaded though, correct:

$ lsmod | grep samsung_galaxybook
samsung_galaxybook     24576  0
platform_profile       12288  1 samsung_galaxybook
wmi                    40960  3 video,samsung_galaxybook,wmi_bmof

I do not see the samsung-galaxybook class here. I assume I should?

$ ls /sys/class/leds
input2::capslock  input2::numlock  input2::scrolllock  mmc0::  phy0-led

The keyboard backlight still does not work, and, the driver does not reload upon reboot.

bryan977 commented 4 months ago

Also, I am running the Samsung Galaxy Book Pro 360. Here is the evemu-describe output. Can we add this to the 61-keyboard-samsung-galaxybook.hwdb file?

$ sudo evemu-describe
Available devices:
/dev/input/event0:  Lid Switch
/dev/input/event1:  Power Button
/dev/input/event2:  AT Translated Set 2 keyboard
/dev/input/event3:  ZNT0001:00 14E5:650E Mouse
/dev/input/event4:  ZNT0001:00 14E5:650E Touchpad
/dev/input/event5:  gpio-keys
/dev/input/event6:  ELAN902C:00 04F3:2DCE
/dev/input/event7:  ELAN902C:00 04F3:2DCE UNKNOWN
/dev/input/event8:  WCOM0134:00 2D1F:0135 Stylus
/dev/input/event9:  WCOM0134:00 2D1F:0135
/dev/input/event10: Video Bus
/dev/input/event11: Intel HID events
/dev/input/event12: Intel HID 5 button array
/dev/input/event13: ELAN902C:00 04F3:2DCE UNKNOWN
/dev/input/event14: sof-hda-dsp Mic
/dev/input/event15: sof-hda-dsp Headphone
/dev/input/event16: sof-hda-dsp HDMI/DP,pcm=3
/dev/input/event17: sof-hda-dsp HDMI/DP,pcm=4
/dev/input/event18: sof-hda-dsp HDMI/DP,pcm=5
Select the device event number [0-18]: 2                  
# EVEMU 1.3
# Kernel: 6.5.0-41-generic
# DMI: dmi:bvnAmericanMegatrendsInternational,LLC.:bvrP14AKH.029.231116.KS:bd11/16/2023:br5.19:svnSAMSUNGELECTRONICSCO.,LTD.:pn930QDB:pvrP14AKH:rvnSAMSUNGELECTRONICSCO.,LTD.:rnNP930QDB-KD1US:rvrSGLA867A1X-C01-G001-S0002+10.0.19042:cvnSAMSUNGELECTRONICSCO.,LTD.:ct31:cvrN/A:skuSCAI-A5A5-A5A5-TGL3-PAKH:
# Input device name: "AT Translated Set 2 keyboard"
# Input device ID: bus 0x11 vendor 0x01 product 0x01 version 0xab83
# Supported events:
#   Event type 0 (EV_SYN)
#     Event code 0 (SYN_REPORT)
#     Event code 1 (SYN_CONFIG)
#     Event code 2 (SYN_MT_REPORT)
#     Event code 3 (SYN_DROPPED)
#     Event code 4 ((null))
#     Event code 5 ((null))
#     Event code 6 ((null))
#     Event code 7 ((null))
#     Event code 8 ((null))
#     Event code 9 ((null))
#     Event code 10 ((null))
#     Event code 11 ((null))
#     Event code 12 ((null))
#     Event code 13 ((null))
#     Event code 14 ((null))
#     Event code 15 (SYN_MAX)
#   Event type 1 (EV_KEY)
#     Event code 1 (KEY_ESC)
#     Event code 2 (KEY_1)
#     Event code 3 (KEY_2)
#     Event code 4 (KEY_3)
#     Event code 5 (KEY_4)
#     Event code 6 (KEY_5)
#     Event code 7 (KEY_6)
#     Event code 8 (KEY_7)
#     Event code 9 (KEY_8)
#     Event code 10 (KEY_9)
#     Event code 11 (KEY_0)
#     Event code 12 (KEY_MINUS)
#     Event code 13 (KEY_EQUAL)
#     Event code 14 (KEY_BACKSPACE)
#     Event code 15 (KEY_TAB)
#     Event code 16 (KEY_Q)
#     Event code 17 (KEY_W)
#     Event code 18 (KEY_E)
#     Event code 19 (KEY_R)
#     Event code 20 (KEY_T)
#     Event code 21 (KEY_Y)
#     Event code 22 (KEY_U)
#     Event code 23 (KEY_I)
#     Event code 24 (KEY_O)
#     Event code 25 (KEY_P)
#     Event code 26 (KEY_LEFTBRACE)
#     Event code 27 (KEY_RIGHTBRACE)
#     Event code 28 (KEY_ENTER)
#     Event code 29 (KEY_LEFTCTRL)
#     Event code 30 (KEY_A)
#     Event code 31 (KEY_S)
#     Event code 32 (KEY_D)
#     Event code 33 (KEY_F)
#     Event code 34 (KEY_G)
#     Event code 35 (KEY_H)
#     Event code 36 (KEY_J)
#     Event code 37 (KEY_K)
#     Event code 38 (KEY_L)
#     Event code 39 (KEY_SEMICOLON)
#     Event code 40 (KEY_APOSTROPHE)
#     Event code 41 (KEY_GRAVE)
#     Event code 42 (KEY_LEFTSHIFT)
#     Event code 43 (KEY_BACKSLASH)
#     Event code 44 (KEY_Z)
#     Event code 45 (KEY_X)
#     Event code 46 (KEY_C)
#     Event code 47 (KEY_V)
#     Event code 48 (KEY_B)
#     Event code 49 (KEY_N)
#     Event code 50 (KEY_M)
#     Event code 51 (KEY_COMMA)
#     Event code 52 (KEY_DOT)
#     Event code 53 (KEY_SLASH)
#     Event code 54 (KEY_RIGHTSHIFT)
#     Event code 55 (KEY_KPASTERISK)
#     Event code 56 (KEY_LEFTALT)
#     Event code 57 (KEY_SPACE)
#     Event code 58 (KEY_CAPSLOCK)
#     Event code 59 (KEY_F1)
#     Event code 60 (KEY_F2)
#     Event code 61 (KEY_F3)
#     Event code 62 (KEY_F4)
#     Event code 63 (KEY_F5)
#     Event code 64 (KEY_F6)
#     Event code 65 (KEY_F7)
#     Event code 66 (KEY_F8)
#     Event code 67 (KEY_F9)
#     Event code 68 (KEY_F10)
#     Event code 69 (KEY_NUMLOCK)
#     Event code 70 (KEY_SCROLLLOCK)
#     Event code 71 (KEY_KP7)
#     Event code 72 (KEY_KP8)
#     Event code 73 (KEY_KP9)
#     Event code 74 (KEY_KPMINUS)
#     Event code 75 (KEY_KP4)
#     Event code 76 (KEY_KP5)
#     Event code 77 (KEY_KP6)
#     Event code 78 (KEY_KPPLUS)
#     Event code 79 (KEY_KP1)
#     Event code 80 (KEY_KP2)
#     Event code 81 (KEY_KP3)
#     Event code 82 (KEY_KP0)
#     Event code 83 (KEY_KPDOT)
#     Event code 85 (KEY_ZENKAKUHANKAKU)
#     Event code 86 (KEY_102ND)
#     Event code 87 (KEY_F11)
#     Event code 88 (KEY_F12)
#     Event code 89 (KEY_RO)
#     Event code 91 (KEY_HIRAGANA)
#     Event code 92 (KEY_HENKAN)
#     Event code 93 (KEY_KATAKANAHIRAGANA)
#     Event code 94 (KEY_MUHENKAN)
#     Event code 95 (KEY_KPJPCOMMA)
#     Event code 96 (KEY_KPENTER)
#     Event code 97 (KEY_RIGHTCTRL)
#     Event code 98 (KEY_KPSLASH)
#     Event code 99 (KEY_SYSRQ)
#     Event code 100 (KEY_RIGHTALT)
#     Event code 102 (KEY_HOME)
#     Event code 103 (KEY_UP)
#     Event code 104 (KEY_PAGEUP)
#     Event code 105 (KEY_LEFT)
#     Event code 106 (KEY_RIGHT)
#     Event code 107 (KEY_END)
#     Event code 108 (KEY_DOWN)
#     Event code 109 (KEY_PAGEDOWN)
#     Event code 110 (KEY_INSERT)
#     Event code 111 (KEY_DELETE)
#     Event code 112 (KEY_MACRO)
#     Event code 113 (KEY_MUTE)
#     Event code 114 (KEY_VOLUMEDOWN)
#     Event code 115 (KEY_VOLUMEUP)
#     Event code 116 (KEY_POWER)
#     Event code 117 (KEY_KPEQUAL)
#     Event code 118 (KEY_KPPLUSMINUS)
#     Event code 119 (KEY_PAUSE)
#     Event code 121 (KEY_KPCOMMA)
#     Event code 122 (KEY_HANGEUL)
#     Event code 123 (KEY_HANJA)
#     Event code 124 (KEY_YEN)
#     Event code 125 (KEY_LEFTMETA)
#     Event code 126 (KEY_RIGHTMETA)
#     Event code 127 (KEY_COMPOSE)
#     Event code 128 (KEY_STOP)
#     Event code 140 (KEY_CALC)
#     Event code 142 (KEY_SLEEP)
#     Event code 143 (KEY_WAKEUP)
#     Event code 148 (KEY_PROG1)
#     Event code 149 (KEY_PROG2)
#     Event code 150 (KEY_WWW)
#     Event code 155 (KEY_MAIL)
#     Event code 156 (KEY_BOOKMARKS)
#     Event code 157 (KEY_COMPUTER)
#     Event code 158 (KEY_BACK)
#     Event code 159 (KEY_FORWARD)
#     Event code 163 (KEY_NEXTSONG)
#     Event code 164 (KEY_PLAYPAUSE)
#     Event code 165 (KEY_PREVIOUSSONG)
#     Event code 166 (KEY_STOPCD)
#     Event code 172 (KEY_HOMEPAGE)
#     Event code 173 (KEY_REFRESH)
#     Event code 183 (KEY_F13)
#     Event code 184 (KEY_F14)
#     Event code 185 (KEY_F15)
#     Event code 192 (KEY_F22)
#     Event code 193 (KEY_F23)
#     Event code 202 (KEY_PROG3)
#     Event code 217 (KEY_SEARCH)
#     Event code 224 (KEY_BRIGHTNESSDOWN)
#     Event code 225 (KEY_BRIGHTNESSUP)
#     Event code 226 (KEY_MEDIA)
#     Event code 227 (KEY_SWITCHVIDEOMODE)
#     Event code 236 (KEY_BATTERY)
#     Event code 238 (KEY_WLAN)
#   Event type 4 (EV_MSC)
#     Event code 4 (MSC_SCAN)
#   Event type 17 (EV_LED)
#     Event code 0 (LED_NUML)
#        State 0
#     Event code 1 (LED_CAPSL)
#        State 0
#     Event code 2 (LED_SCROLLL)
#        State 0
#   Event type 20 (EV_REP)
#     Event code 0 (REP_DELAY)
#     Event code 1 (REP_PERIOD)
# Properties:
N: AT Translated Set 2 keyboard
I: 0011 0001 0001 ab83
P: 00 00 00 00 00 00 00 00
B: 00 0b 00 00 00 00 00 00 00
B: 01 fe ff ff ff ff ff ff ff
B: 01 ff ff ef fb df ff ff fe
B: 01 01 d0 70 f8 78 30 80 03
B: 01 03 04 00 02 0f 50 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 02 00 00 00 00 00 00 00 00
B: 03 00 00 00 00 00 00 00 00
B: 04 10 00 00 00 00 00 00 00
B: 05 00 00 00 00 00 00 00 00
B: 11 07 00 00 00 00 00 00 00
B: 12 00 00 00 00 00 00 00 00
B: 14 03 00 00 00 00 00 00 00
B: 15 00 00 00 00 00 00 00 00
B: 15 00 00 00 00 00 00 00 00
bryan977 commented 4 months ago

I added the following to the /etc/udev/hwdb.d/61-keyboard-samsung-galaxybook.hwdb file based on the above and still no luck:

# xxxQDB: Galaxy Book 360 Pro series
evdev:atkbd:dmi:bvn*:bvr*:bd*:svn[sS][aA][mM][sS][uU][nN][gG]*:pn[0-9][0-9][0-9]QDB:*
Gugu7264 commented 4 months ago

Same issue here on Samsung Galaxy Book 4. Module installed fine but keyboard isn't backlit. (By the way, for some reason on my laptop F9 turns the screen off?? (even before module install though)).

If needed, I can provide any logs that can be useful for fixing this ;)

bryan977 commented 4 months ago

I ended up giving up. Too many issues trying to get Linux to be fully functional on Samsung hardware. I purchased a Dell XPS 13 9340 with Ubuntu pre-installed. Everything works ;-)

I still have the Samsung laptop, so if we ever get full drivers, maybe I can put it back into service.

Zippy-boy commented 4 months ago

Ima alos trying to get my galaxy book pro 360 working with this driver, but whenever I try and make it gives me the error: make: *** /lib/modules/6.9.8-200.fc40.x86_64/build: No such file or directory. Stop. Any idea why this is?

joshuagrisham commented 4 months ago

Hi everyone here; regarding support for Galaxy Book(1) Pro 360 and Galaxy Book 4, I have no idea which devices are present on those models and/or if they would be compatible to how this platform driver is intended to work. It is the same story as I posted here:

Hi @axcosta and @PremiumUsername , sorry for my delay in getting back to you!

I built this driver by reverse engineering + debugging how it works in Windows on my Galaxy Book2 Pro 15.6 so can never be 100% sure it is going to work exactly the same on other devices.

Having said that, the driver works by executing methods on a Samsung ACPI device (the one they called SCAI) which seems "relatively" standardized across several models.

On my particular device, the ACPI Device ID for the SCAI device is SAM0429 but when I was looking into this in Windows I saw that the same driver on my device was matching both SAM0427 and SAM0429. So far I have only put SAM0429 in the code for this platform driver, as it is the only device I have access to test and would not want to make it even easier for anyone to accidentally harm their device :wink:

But, as said, it probably works relatively out-of-the-box with SAM0427 and possibly other device IDs as well, and because it is using ACPI then the most likely scenario is that either the device method names are different or require different payloads and will just reject/not respond to anything that is sent that would not work with other devices. However, if Samsung made other devices that happen to use exactly the same SCAI device, with exactly the same device methods (CSFI and CSXI), that can accept the exact same kind of input parameters (so that it is not rejected by the ACPI subsystem and actually executes the code in the BIOS), but behave completely differently and/or would "harm" the device somehow? Hmm I guess it is entirely possible but it seems pretty unlikely (I certainly would hope, anyway! :smile: )

If you run something like ls /sys/devices/platform/ | grep -i SAM do you see a match? If so, what is the device ID that shows up there? (for me it is SAM0429:00) Perhaps we can try adding it to the code and you can test to see if the driver will work on your device?

If there is no match, and/or you don't see anything under /sys/devices/platform/ that look promising, how does it look in Windows on your device? Specifically, is there a device driver installed called Samsung System Event Controller, and if you look at its properties / INI file can you tell what it has for device ID / vendor ID / product ID / etc ?

Originally posted by @joshuagrisham in https://github.com/joshuagrisham/samsung-galaxybook-extras/issues/9#issuecomment-2228058826

Please feel free to take a look at the same on your devices and report back; it might be possible to just add your device's device IDs to the table and then it "just starts working" -- will just need to try it and see!