# Gole 1 Pro Linux Fix **Repository Path**: meniny/gole-1-pro-linux-fix ## Basic Information - **Project Name**: Gole 1 Pro Linux Fix - **Description**: 高乐 Gole 1 Pro 安装 Linux (Kubuntu) 及后续问题修复 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2023-08-23 - **Last Updated**: 2024-10-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README // :doctype: book :doctype: article // :doctype: manpage // :doctype: inline :title-page: :page-layout!: :sectanchors: :sectlinks: :sectnums: :toc: left :toclevels: 6 :toc-title: 索引 :doctitle: 高乐 `Gole 1 Pro` 安装 Linux 及后续问题修复 // :source-highlighter: pygments :source-highlighter: rouge :nofooter: :scripts: cjk // :last-update-label!: // :docinfo: shared-footer :priority1: Urgent :priority2: High :priority3: Middle :priority4: Low :priority5: NiceToHave :rank0: ☆☆☆☆☆ :rank1: ★☆☆☆☆ :rank2: ★★☆☆☆ :rank3: ★★★☆☆ :rank4: ★★★★☆ :rank5: ★★★★★ = {doctitle} :author: Ezra :email: ezra@hotodogo.com :revnumber: 1.0.3 :revdate: August 24th, 2023 // :revremark: :version-label!: // :data-uri: :icons: font [NOTE] ==== See link:https://hotodogo.com/blog/post/name/gole-1-pro-linux-fix/[https://hotodogo.com/blog/post/name/gole-1-pro-linux-fix/] for more information. ==== == 免责声明 [CAUTION] ==== 本文内容仅为交流目的,不保证在任何情况下均可达到预期效果,同时所涉及操作存在一定风险,因此造成的任何损失本人概不负责,请在继续操作前慎重考虑。 此外,请务必对数据进行备份,以免造成不必要的损失。 ==== == 写在前面 image::gole-1-pro.jpg[gole-1-pro.jpg, width="75%"] 最近入手了一台高乐 `Gole 1 Pro` 小主机,自带了 5.5 英寸触摸屏和电池,十分小巧便携。 由于小主机没有自带风扇,所以为了降低发热,我分出 60GB 安装了 `Kubuntu`。其实系统的安装过程并没有什么特别,但安装之后存在一些重要的问题,需要手动解决,记录如下文。 > Linux 下具体的问题表现为: > > * 没有 `WiFi` > * 没有声音,但耳机可用 > * 始终显示 `“未在充电”` > * 界面是旋转显示的状态 == 问题修复 相关文件和包均已上传到 `gitee` 仓库: ```sh sudo apt install git git clone https://gitee.com/meniny/gole-1-pro-linux-fix.git cd gole-1-pro-linux-fix/ ``` [CAUTION] ==== 虽然已经附带离线的内核以及网卡驱动、蓝牙驱动源代码等,但并没有附带编译工具、`ALSA` 的离线包,建议通过网线或 `Linux` 免驱的外置无线网卡连接到网络。 淘宝可以很容易找到 `COMFAST CF-WU810N` 外置无线网卡,大概不到 20 元。 ==== === 画面旋转 首先是屏幕旋转的问题,登录后桌面的旋转可以在设置中的显示设置中进行配置,各种桌面环境中都大同小异,这里就不赘述了。 比较重要的是登录界面旋转和触摸屏旋转。 ==== 登录界面 由于我使用的是 `Kubuntu`,因此默认使用 `sddm` 作为 `Display Manager`。 那么,首先我们确定一下显示器的名称: ```sh xrandr ``` 输出的结果显示: ```sh Screen 0: minimum 320 x 200, current 1280 x 720, maximum 16384 x 16384 DSI-1 connected primary 1280x720+0+0 right (normal left inverted right x axis y axis) 0mm x 0mm 720x1280 60.00*+ 1280x720 60.00 960x720 60.00 ... ``` 这里记录 `DSI-1` 即可,接下来编辑 `sddm` 配置来旋转登录界面: ```sh sudo nano /etc/sddm.conf ``` 加入下面的内容,如果 `[X11]` 已经存在,则加入到已存在的组中即可: ```sh [X11] DisplayCommand=/usr/share/sddm/scripts/Xsetup ``` 继续编辑 `/usr/share/sddm/scripts/Xsetup` 文件: ```sh sudo nano /usr/share/sddm/scripts/Xsetup ``` 加入下面的内容: ```sh xrandr --output DSI-1 --rotate right ``` 安装完成之后需要**重启系统**生效。 > 其他 `DM` 的旋转方法其实也大同小异,可以到 `Google` 搜索,例如 `rotate lightdm`, `rotate gdm` 等。 ==== 触屏操控 接下来,你会发现触摸屏的操作是不正确的,点击与实际响应的位置不一致。 那么首先我们确认一下触屏设备的名称: ```sh xinput -list ``` 可以很明显的找到触屏设备,也即 `Goodix Capacitive TouchScreen`: ```sh ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ BY Tech Air60 id=9 [slave pointer (2)] ⎜ ↳ Logitech MX Master 3 id=11 [slave pointer (2)] ⎜ ↳ Telink Wireless Receiver Mouse id=14 [slave pointer (2)] ⎜ ↳ Telink Wireless Receiver Consumer Control id=17 [slave pointer (2)] ⎜ ↳ Goodix Capacitive TouchScreen id=20 [slave pointer (2)] ⎣ Virtual core keyboard id=3 [master keyboard (2)] ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)] ↳ Power Button id=6 [slave keyboard (3)] ↳ Video Bus id=7 [slave keyboard (3)] ↳ Telink Wireless Receiver System Control id=8 [slave keyboard (3)] ↳ BY Tech Air60 id=10 [slave keyboard (3)] ↳ Logitech MX Master 3 id=12 [slave keyboard (3)] ↳ Intel HID events id=13 [slave keyboard (3)] ↳ Intel HID 5 button array id=15 [slave keyboard (3)] ↳ Telink Wireless Receiver id=16 [slave keyboard (3)] ↳ Telink Wireless Receiver Consumer Control id=18 [slave keyboard (3)] ↳ BY Tech Air60 id=19 [slave keyboard (3)] ↳ Goodix Capacitive TouchScreen id=21 [slave keyboard (3)] ↳ AT Translated Set 2 keyboard id=22 [slave keyboard (3)] ``` 接下来我们需要编辑 `~/.profile` 文件: ```sh nano ~/.profile ``` 在文件末尾加入下面的命令: ```sh # Rotate TouchScreen to Right xrandr -o right xinput set-prop 'pointer:Goodix Capacitive TouchScreen' 'Coordinate Transformation Matrix' 0 1 0 -1 0 1 0 0 1 ``` 保存后,执行 `source ~/.profile` 即可生效。 > 如果有兴趣,可以阅读 link:https://wiki.ubuntu.com/X/InputCoordinateTransformation[Ubuntu Wiki 文档] 了解其背后的逻辑。 ===== 横竖切换 现在触摸屏可以正常工作了。如果希望随时切换横竖屏的话,我们需要创建两个脚本: ```sh nano ~/landscape.sh ``` ```sh #!/bin/sh # Rotate TouchScreen to Right xrandr -o right xinput set-prop 'pointer:Goodix Capacitive TouchScreen' 'Coordinate Transformation Matrix' 0 1 0 -1 0 1 0 0 1 ``` ```sh nano ~/portrait.sh ``` ```sh #!/bin/sh # Rotate TouchScreen back to Normal xrandr -o normal xinput set-prop 'pointer:Goodix Capacitive TouchScreen' 'Coordinate Transformation Matrix' 0 0 0 0 0 0 0 0 0 ``` 并通过 `chmod +x ~/landscape.sh`/`chmod +x ~/portrait.sh` 赋予执行权限,以后只需要根据需要运行这两个脚本中的一个,就可以进行横竖屏切换了。 更进一步的,你还可以创建两个图标方便操作: ```sh nano ~/Desktop/landscape.desktop ``` ```sh [Desktop Entry] Name=Landscape Comment=Rotate the screen of Gole 1 Pro to landscape Exec=bash -c 'xrandr -o right; xinput set-prop "pointer:Goodix Capacitive TouchScreen" "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1' Icon=utilities-terminal Terminal=true Type=Application Categories=Application; ``` ```sh nano ~/Desktop/portrait.desktop ``` ```sh [Desktop Entry] Name=Portrait Comment=Rotate the screen of Gole 1 Pro to portrait Exec=bash -c 'xrandr -o normal; xinput set-prop "pointer:Goodix Capacitive TouchScreen" "Coordinate Transformation Matrix" 0 0 0 0 0 0 0 0 0' Icon=utilities-terminal Terminal=true Type=Application Categories=Application; ``` 并通过 `chmod +x ~/Desktop/landscape.desktop`/`chmod +x ~/Desktop/portrait.desktop` 赋予执行权限,以后只需要根据需要点击桌面上的图标,就可以进行横竖屏切换了。 image::tsicons.jpg[tsicons.jpg, width="30%"] === 内核回退 [CAUTION] ==== 截止至本文完成时,最新的稳定内核是 `6.2.0`,但是网卡驱动并没有找到能link:https://github.com/lwfinger/rtw89[在 `5.18` 以上内核运行]正常的版本,所以只好回退内核到 `5.15.0-79` 版本。 ==== ```sh sudo apt update sudo apt --fix-missing install linux-headers-5.15.0-79_5.15.0-79.86_all.deb linux-headers-5.15.0-79-generic linux-image-5.15.0-79-generic linux-modules-5.15.0-79-generic linux-modules-extra-5.15.0-79-generic ``` [NOTE] ==== 如果你现在没有网络,或者无法在 `Ubuntu` 仓库找到对应的包,可以直接安装 `gitee` 仓库中的相关包: ```sh sudo dpkg -i linux-headers-5.15.0-79-generic_5.15.0-79.86_amd64.deb linux-image-5.15.0-79-generic_5.15.0-79.86_amd64.deb linux-modules-5.15.0-79-generic_5.15.0-79.86_amd64.deb linux-modules-extra-5.15.0-79-generic_5.15.0-79.86_amd64.deb ``` ==== 安装完成之后需要**重启系统**生效,并且**在 GRUB 界面选择 Ubuntu, with kernel 5.15.0-79-generic** 启动。 === GRUB ==== 默认内核 方便起见可以直接修改 `/etc/default/grub` 通过 `GRUB_DEFAULT=0` 来控制默认的内核。 ```sh sudo nano /etc/default/grub ``` 如果你的情况和我一样,在默认内核的基础上安装了上述的内核,那么 `5.15.0-79-generic` 很可能是 `GRUB` 菜单中 [.underline]#第 2 项的第 3 个子项#。那么我们需要将 `GRUB_DEFAULT=0` 改为 `GRUB_DEFAULT='1>2'`,因为所有的序列都是从 `0` 开始编号的。 完成后**务必**要执行 `sudo update-grub` 进行更新。 如果后续安装了新内核,最好确认一下是否需要更改默认内核。 image:grub.jpg[grub.jpg, width="50%"] ==== 终端旋转 类似的,我们还需要修改 `GRUB_CMDLINE_LINUX_DEFAULT`、`GRUB_CMDLINE_LINUX`、`GRUB_GFXMODE` 来旋转开关机时的终端界面: ```sh GRUB_CMDLINE_LINUX_DEFAULT="video=efifb fbcon=rotate_all:1 quiet" GRUB_CMDLINE_LINUX="video=efifb fbcon=rotate_all:1 quiet splash" GRUB_GFXMODE=1280x720,auto ``` 完成后需要执行 `sudo update-grub` 并**重启系统**生效。 === 充电状态 如果充电状态或电量显示出现异常,需要安装 `linux-hwe-5.15-headers-5.15.0-79: ```sh sudo apt install linux-hwe-5.15-headers-5.15.0-79 ``` [NOTE] ==== 如果你现在没有网络,或者无法在 `Ubuntu` 仓库找到对应的包,可以直接安装 `gitee` 仓库中的相关包: ```sh sudo dpkg -i linux-hwe-5.15-headers-5.15.0-79_5.15.0-79.86~20.04.2_all.deb ``` ==== 安装完成之后需要**重启系统**生效,并且**在 GRUB 界面选择 Ubuntu, with kernel 5.15.0-79-generic** 启动。 === 无线网络 由于驱动需要自己 `make`,所以我们需要安装依赖: ```sh sudo apt --fix-missing install gcc bc make build-essential ``` 接下来安装 `rtl8852BE_WiFi_linux_v1.19.7.0-18-gee24b6aac.20230614_PC`: ```sh cd rtl8852BE_WiFi_linux_v1.19.7.0-18-gee24b6aac.20230614_PC/ make -j8 sudo make install sudo modprobe 8852be ``` 安装完成之后需要**重启系统**生效,并且**在 GRUB 界面选择 Ubuntu, with kernel 5.15.0-79-generic** 启动。 === 蓝牙扫描 你可能已经发现,此时蓝牙出现了异常,不能扫描甚至不能启动。现在我们来link:https://github.com/HRex39/rtl8852be_bt.git[解决这个问题]: ```sh #相对与刚才的网卡驱动目录 cd ../rtl8852be_bt make sudo make install sudo modprobe btusb ``` 安装完成之后需要**重启系统**生效,并且**在 GRUB 界面选择 Ubuntu, with kernel 5.15.0-79-generic** 启动。 === 声音播放 当然,首先要确定驱动是否安装正常: ```sh inxi -A ``` 如果音频设备的 `driver` 显示 `snd_hda_intel` 则正常。 ```sh Audio: Device-1: Intel Celeron/Pentium Silver Processor High Definition Audio driver: snd_hda_intel Sound Server-1: ALSA v: k5.15.0-79-generic running: yes Sound Server-2: PulseAudio v: 15.99.1 running: yes Sound Server-3: PipeWire v: 0.3.48 running: yes ``` > 如果没有 `inxi` 可以通过 `sudo apt install inxi` 进行安装。 接下来安装 `ALSA` 相关工具: ```sh sudo apt --fix-missing install alsa-base alsa-utils alsa-tools alsa-tools-gui alsamixergui ``` 通过 `aplay -l` 可以看到我们的音频设备是 `Realtek ALC269VB Analog`。 ```sh **** PLAYBACK 硬體裝置清單 **** card 0: PCH [HDA Intel PCH], device 0: ALC269VB Analog [ALC269VB Analog] 子设备: 1/1 子设备 #0: subdevice #0 card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0] 子设备: 1/1 子设备 #0: subdevice #0 card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1] 子设备: 1/1 子设备 #0: subdevice #0 ... ``` 启动 `HDAJackRetask`: ```sh hdajackretask ``` 在出现的 `HDAJackRetask` 程序界面中: * 最上方 `Select a codec` 处选择 `Realtek ALC269VB` * 勾选 `Internel Speaker` 一栏的 `Override` * 选择 `Line Out (Front)` 项 * 点击 `Install boot override` image::hdajackretask.jpg[hdajackretask.jpg, width="50%"] 安装完成之后需要**重启系统**生效,并且**在 GRUB 界面选择 Ubuntu, with kernel 5.15.0-79-generic** 启动。 [NOTE] ==== 如果仍旧存在问题,可以尝试手动执行 `sudo alsa force-reload`。 ==== == 扩展 TLDR; 至此,在 `Linux` (`Kubuntu with kernel 5.15.0-79-generic`) 环境下的网络、蓝牙、音频、画面等问题已经全部解决。 后续,如果感兴趣的话,在理论上你也可以手动编译内核,并加入正确的驱动。 可以通过以下页面获取资源: * link:https://github.com/torvalds/linux/tree/master/drivers[Linux Source Code: drivers] * link:https://packages.ubuntu.com/[Ubuntu Packages] `Makefile` 示例: ```sh obj-m += thedriver.o all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules clean: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean ``` == 其它 === 自动登录 由于 `Linux` 系统可能没有自带屏幕触摸键盘,因此最好设置用户自动登录,以便在没有键盘的时候也可以登入系统。 === 屏幕键盘 可以通过 `sudo apt install onboard` 安装 link:https://launchpad.net/onboard[Onboard] 屏幕键盘并设置开机启动,不过,它似乎并不能在登录界面使用。 image:onboard.jpg[onboard.jpg, width="50%"] === 便携键鼠 日本品牌 `SANWA` 的 `400-SKB070` 折叠键盘是个不错的选择,支持三个蓝牙连接,且自带了一个小型触控板。折叠后仅与一台 `iPhone 14` 尺寸相当。 当然,缺点也有,这个键盘没有 `F1~F12` 功能键,也没有 `Escape` 键,如果比较介意的话你也可以选择 `GSKBBT30BK`。 image:sanwa.jpg[sanwa.jpg, width="50%"] 另一个推荐是 `RII k06` 迷你键盘,长度与 `Gole 1 Pro` 相当,支持蓝牙及 `2.4G` 双模式,自带触摸板,而且按键齐全。 image:rii.jpg[rii.jpg, width="50%"] ==== 键盘隐射 题外话,对于没有 `Escape` 键的问题,可以通过键盘映射来解决,在 `Linux` 中可以使用 link:https://github.com/sezanzeb/input-remapper[Input Remapper],`Windows` 中可以使用 link:https://github.com/microsoft/PowerToys[PowerToy],`macOS` 中可以使用 link:https://karabiner-elements.pqrs.org/[Karabiner Elements]。 --- [.text-center] [.small]#Made with ♡ in Shenzhen#