├── .github
└── FUNDING.yml
├── .gitignore
├── LICENSE
├── README.md
├── data
├── 20-gpd-micropc-intel.conf
├── 20-gpd-pocket-intel.conf
├── 20-gpd-pocket2-intel.conf
├── 20-gpd-pocket3-intel.conf
├── 20-topjoy-falcon-intel.conf
├── 40-gpd-micropc-monitor.conf
├── 40-gpd-pocket-monitor.conf
├── 40-gpd-pocket2-monitor.conf
├── 40-gpd-pocket3-monitor.conf
├── 40-gpd-win-max-monitor.conf
├── 40-gpd-win2-monitor.conf
├── 40-gpd-win3-monitor.conf
├── 40-topjoy-falcon-monitor.conf
├── 61-gpd-pocket3-sensor-local.hwdb
├── 61-gpd-win-max-sensor-local.hwdb
├── 61-gpd-win3-sensor-local.hwdb
├── 61-topjoy-falcon-sensor-local.hwdb
├── 80-gpd-micropc-trackpoint.conf
├── 80-gpd-pocket-trackpoint.conf
├── 80-gpd-pocket2-trackpoint.conf
├── 80-gpd-pocket3-trackpoint.conf
├── 80-topjoy-falcon-trackpoint.conf
├── 90-falcon-topjoy.gschema.override
├── 90-gpd-p2-max.gschema.override
├── 90-gpd-pocket.gschema.override
├── 90-gpd-pocket2.gschema.override
├── 90-gpd-pocket3.gschema.override
├── 99-gpd-pocket-touch.rules
├── 99-gpd-pocket2-touch.rules
├── 99-gpd-pocket3-touch.rules
├── 99-gpd-win-max-touch.rules
├── 99-gpd-win2-touch.rules
├── 99-gpd-win3-touch.rules
├── 99-topjoy-falcon-touch.rules
├── alsa-gpd-pocket3.conf
├── alsa-gpd-win3.conf
├── brcmfmac4356-pcie.txt
├── gpd-micropc-monitors.xml
├── gpd-micropc.cfg
├── gpd-pocket-monitors.xml
├── gpd-pocket.cfg
├── gpd-pocket2-monitors.xml
├── gpd-pocket2.cfg
├── gpd-pocket3-monitors.xml
├── gpd-pocket3.cfg
├── gpd-win-max-edid.bin
├── gpd-win-max-monitors.xml
├── gpd-win-max-new.cfg
├── gpd-win-max.cfg
├── gpd-win2-monitors.xml
├── gpd-win2.cfg
├── gpd-win3-monitors.xml
├── gpd-win3.cfg
├── topjoy-falcon-monitors.xml
├── topjoy-falcon.cfg
├── umpc-display-rotate.c
├── umpc-display-rotate.desktop
├── umpc-display-scaler
├── umpc-display-scaler.desktop
└── umpc-display-scaler.service
├── gpd-pockets.jpg
├── umpc-ubuntu-respin-all.sh
├── umpc-ubuntu-respin.sh
└── umpc-ubuntu.sh
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: flexiondotorg
4 | patreon: wimpysworld
5 | custom: https://wimpysworld.io/tip
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | *.iso
3 | *.sha256
4 | *.sign
5 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Wimpy's World
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # UMPC hardware configuration for Ubuntu
2 |
3 | Here are a couple of scripts for Ultra Mobile PCs (UMPC) such as the
4 | [GPD Pocket](https://gpd.hk/gpdpocket), [GPD Pocket 2](https://gpd.hk/gpdpocket2),
5 | [GPD Pocket 3](https://gpd.hk/gpdpocket3), [GPD MicroPC](https://gpd.hk/gpdmicropc),
6 | [GPD WIN 2](https://gpd.hk/gdpwin2), [GPD P2 Max](https://www.gpd.hk/gpdp2max),
7 | [GPD WIN Max](https://gpd.hk/gpdwinmax) and [Topjoy Falcon](https://www.kickstarter.com/projects/440069565/falcon-worlds-first-8-inch-2-in-1-laptop)
8 | for Ubuntu users.
9 |
10 | * `umpc-ubuntu.sh`: install the required hardware configuration on a running Ubuntu install.
11 | * `umpc-ubuntu-respin.sh`: modify an existing Ubuntu .iso image with UMPC specific hardware configuration.
12 |
13 | Ultra Mobile PCs (UMPC) have had something of a resurgence in recent years
14 | thanks to very successful crowd funding campaigns for netbook style laptops
15 | featuring a high resolution touch displays housed in an aluminium alloy
16 | body. These scripts for UMPC devices are based on the excellent work by
17 | [Hans de Goede](https://hansdegoede.livejournal.com/), [nexus511](https://apt.nexus511.net/),
18 | [stockmind](https://github.com/stockmind/gpd-pocket-ubuntu-respin) and many
19 | others.
20 |
21 | 
22 |
23 | ## Pre-configured images
24 |
25 | The Ubuntu MATE team offers bespoke images for the
26 | [GPD Pocket](https://gpd.hk/gpdpocket),
27 | [GPD Pocket 2](https://gpd.hk/gpdpocket2),
28 | [GPD Pocket 3](https://gpd.hk/gpdpocket3),
29 | [GPD WIN 2](https://gpd.hk/gdpwin2),
30 | [GPD MicroPC](https://gpd.hk/gpdmicropc),
31 | [GPD P2 Max](https://www.gpd.hk/gpdp2max),
32 | [GPD WIN Max](https://gpd.hk/gpdwinmax) and
33 | [Topjoy Falcon](https://www.kickstarter.com/projects/440069565/falcon-worlds-first-8-inch-2-in-1-laptop)
34 | that include the hardware specific tweaks to get these devices working
35 | *"out of the box"* without any faffing about. Some models of the OneMix
36 | Yoga devices are also supported.
37 |
38 | *
39 |
40 | ## What works
41 |
42 | The [Ubuntu MATE images for the UMPCs](https://ubuntu-mate.org/umpcs/) add the following tweaks:
43 |
44 | * Enable **frame buffer, Plymouth and Xorg display rotation**.
45 | * Supports `modesetting` *and* `xorg-video-intel` display drivers.
46 | * Enable **TearFree rendering by default**.
47 | * Enable touch screen rotation for Xorg and Wayland.
48 | * Enable **scroll wheel emulation** for Xorg.
49 | * While holding down the **right track point button** on the Pocket, Pocket 2 & Topjoy Falcon.
50 | * While holding down the **centre track point button** on the MicroPC & Pocket 3.
51 | * Enable double size console (tty) font resolution for high resolution devices.
52 | * Enable **fractional scaling** for 1920x1200 displays. *(MATE Desktop only)*
53 | * Results in an effective resolution of 1280x800 to make the display panels easily readable.
54 | * Simple to toggle on/off if you want to restore full resolution.
55 | * GPD Pocket:
56 | * BRMC4356 WiFi firmware enabled by default.
57 | * Fan control kernel module enabled by default.
58 | * GPD Pocket 3 & TopJoy Falcon:
59 | * **Accelerometer support for automatic screen rotation**.
60 | * GPD WIN Max:
61 | * Features a custom, persistent, EDID.
62 |
63 | ## Known Issues
64 |
65 | ### The GRUB menu is rotated 90 degrees
66 |
67 | The workaround is to tilt your head. Issue affects:
68 |
69 | * GPD Pocket
70 | * GPD Pocket 3
71 | * GPD MicroPC
72 | * GPD WIN 2
73 | * GPD WIN Max
74 | * TopJoy Falcon
75 |
76 | ### Boot splash is rotated 90 degrees
77 |
78 | The workaround is to tilt your head. Issue affects:
79 |
80 | * GPD WIN Max
81 |
82 | ### Touch coordinates incorrect when external HDMI monitor is connected
83 |
84 | When a HDMI display is connected, the touch coordinates on the internal display are incorrect. Issue affects:
85 |
86 | * GPD Pocket 3
87 |
88 | ## The Scripts
89 |
90 | These scripts have been tested on [Ubuntu MATE](https://ubuntu-mate.org) 20.04.1.
91 | All Ubuntu flavours should work although if you use Wayland your mileage may vary.
92 |
93 | ### umpc-ubuntu.sh
94 |
95 | Install one of the Ubuntu 20.04 (or newer) flavours on a supported UMPC
96 | device and run the following to inject the required hardware configuration.
97 |
98 | ```bash
99 | git clone https://github.com/wimpysworld/umpc-ubuntu.git
100 | cd umpc-ubuntu
101 | ```
102 |
103 | Edit `./umpc-ubuntu.sh` and change `UMPC="gpd-pocket3"` at the top of the script
104 | to match your computer, supported options are: `gpd-pocket`, `gpd-pocket2`,
105 | `gpd-pocket3`, `gpd-p2-max`, `gpd-micropc`, `gpd-win2`, `gpd-win-max` or `topjoy-falcon`.
106 |
107 | Then run the script to enable the configuration tweaks.
108 |
109 | ```bash
110 | sudo ./umpc-ubuntu.sh enable
111 | ```
112 |
113 | ### umpc-ubuntu-respin.sh
114 |
115 | ```bash
116 | git clone https://github.com/wimpysworld/umpc-ubuntu.git
117 | cd umpc-ubuntu
118 | ```
119 |
120 | * Download an .iso image for one of the Ubuntu MATE 20.04 (or newer) or one of the other Ubuntu flavours.
121 |
122 | ```bash
123 | sudo ./umpc-ubuntu-respin.sh -d gpd-pocket ubuntu-mate-20.04.3-desktop-amd64.iso
124 | sudo ./umpc-ubuntu-respin.sh -d gpd-pocket2 ubuntu-mate-20.04.3-desktop-amd64.iso
125 | sudo ./umpc-ubuntu-respin.sh -d gpd-pocket3 ubuntu-mate-21.10-desktop-amd64.iso
126 | sudo ./umpc-ubuntu-respin.sh -d gpd-micropc ubuntu-mate-20.04.3-desktop-amd64.iso
127 | sudo ./umpc-ubuntu-respin.sh -d gpd-p2-max ubuntu-mate-20.04.3-desktop-amd64.iso
128 | sudo ./umpc-ubuntu-respin.sh -d gpd-win2 ubuntu-mate-20.04.3-desktop-amd64.iso
129 | sudo ./umpc-ubuntu-respin.sh -d gpd-win-max ubuntu-mate-20.04.3-desktop-amd64.iso
130 | sudo ./umpc-ubuntu-respin.sh -d topjoy-falcon ubuntu-mate-20.04.3-desktop-amd64.iso
131 | ```
132 |
133 | A new .iso will be created that includes the additional hardware tweaks required
134 | by the selected UMPC device.
135 |
136 | ## Accessing boot menus & BIOS
137 |
138 | Switch the device on, immediately hold/tap the corresponding key(s).
139 |
140 | | Device | BIOS | Boot Menu |
141 | | ------------- | ------------ | ------------ |
142 | | GPD Pocket | `Del` | `Fn` + `F7` |
143 | | GPD Pocket 2 | `Fn` + `F12` | `Fn` + `F12` |
144 | | GPD Pocket 3 | `Fn` + `F7` | `Fn` + `F7` |
145 | | GPD WIN 2(!) | `Del` | `Del` |
146 | | GPD WIN 3(!) | `Del` | `Del` |
147 | | GPD MicroPC | `Del` | `Fn` + `F7` |
148 | | GPD P2 Max | `Fn` + `F7` | `Fn` + `F7` |
149 | | GPD WIN Max | `F7` | `F7` |
150 | | OneMix Yoga 2 | `Fn` + `F7` | `Fn` + `F7` |
151 | | TopJoy Falcon | `Fn` + `F2` | `Fn` + `F12` |
152 |
153 | * **GPD WIN 2/3(!)**: Boot it by holding `Del` (Fn+Backspace), navigate to *Save & Exit* and choose the storage device you want to boot from under *Boot Override*
154 |
155 | ## Device matrix
156 |
157 | Please help complete this table by running the following commands from an Ubuntu Live image:
158 |
159 | ```
160 | xrandr --query
161 | xinput
162 | ```
163 |
164 | | Device | Monitor | Resolution | Rotation | Keyboard/Mouse | Touch Screen | Kernel Req | Ubuntu Req | Common |
165 | | ------------- | ------------ | ---------- | -------- | ----------------------------------------- | ----------------------------- | ---------- | ---------- | ------------- |
166 | | GPD Pocket | DSI-1 / DSI1 | 1200x1920 | Right | SINO WEALTH Gaming Keyboard | Goodix Capacitive TouchScreen | >= 4.14 | >= 18.04.2 | gpd-pocket |
167 | | GPD Pocket 2 | eDP-1 / eDP1 | 1200x1920 | Right | HAILUCK CO.,LTD USB KEYBOARD Mouse | Goodix Capacitive TouchScreen | >= 4.18 | >= 18.04.2 | gpd-pocket2 |
168 | | GPD Pocket 3 | DSI-1 / DSI1 | 1200x1920 | Right | HAILUCK CO.,LTD USB KEYBOARD Mouse | GXTP7380:00 27C6:0113 | >= 5.15 | >= 22.04 | gpd-pocket3 |
169 | | GPD WIN 2 | eDP-1 / eDP1 | 720x1280 | Right | HK-ZYYK-US-A1-02-00 USB Keyboard Mouse | Goodix Capacitive TouchScreen | >= 4.18 | >= 19.04 | gpd-win2 |
170 | | GPD WIN 3 | DSI-1 / DSI1 | 720x1280 | Right | | Goodix Capacitive TouchScreen | >= 5.15 | >= 22.04 | gpd-win3 |
171 | | GPD MicroPC | DSI-1 / DSI1 | 720x1280 | Right | AMR-4630-XXX-0- 0-1023 USB KEYBOARD Mouse | n/a | >= 5.2 | >= 19.10 | gpd-micropc |
172 | | GPD P2 Max | eDP-1 / eDP1 | 2560x1600 | n/a | HAILUCK CO.,LTD USB KEYBOARD Mouse | Goodix Capacitive TouchScreen | | | gpd-p2-max |
173 | | GPD WIN Max | eDP-1 / eDP1 | 800x1280 | Right | HTIX5288:00 093A:0255 Mouse | Goodix Capacitive TouchScreen | >= 5.4 | >= 20.04.1 | gpd-win-max |
174 | | OneMix Yoga | | 1200x1920 | Right | HAILUCK CO.,LTD USB KEYBOARD Mouse | Goodix Capacitive TouchScreen | >= 4.18 | >= 18.04.2 | |
175 | | OneMix Yoga 1s | eDP-1 / eDP1 | 1200x1920 | Right | HAILUCK CO.,LTD USB KEYBOARD Mouse | Goodix Capacitive TouchScreen | >= 4.18 | >= 18.04.2 | gpd-pocket2 |
176 | | OneMix Yoga 2 | eDP-1 / eDP1 | 1200x1920 | Right | HAILUCK CO.,LTD USB KEYBOARD Mouse | Goodix Capacitive TouchScreen | >= 4.18 | >= 18.04.2 | gpd-pocket2 |
177 | | TopJoy Falcon | DSI-1 / DSI1 | 1200x1920 | Right | HAILUCK CO.,LTD USB KEYBOARD Mouse | Goodix Capacitive TouchScreen | >= 4.18 | >= 18.04.2 | topjoy-falcon |
178 | | Chuwi Minibook X | DSI-1 / DSI1 | 1200x1920 | Right | SIPODEV USB Composite Device Mouse | | | | |
179 |
--------------------------------------------------------------------------------
/data/20-gpd-micropc-intel.conf:
--------------------------------------------------------------------------------
1 | Section "Device"
2 | Identifier "Device0"
3 | Driver "intel"
4 | Option "AccelMethod" "sna"
5 | Option "TearFree" "true"
6 | Option "DRI" "3"
7 | EndSection
--------------------------------------------------------------------------------
/data/20-gpd-pocket-intel.conf:
--------------------------------------------------------------------------------
1 | Section "Device"
2 | Identifier "Device0"
3 | Driver "intel"
4 | Option "AccelMethod" "sna"
5 | Option "TearFree" "true"
6 | Option "DRI" "3"
7 | EndSection
--------------------------------------------------------------------------------
/data/20-gpd-pocket2-intel.conf:
--------------------------------------------------------------------------------
1 | Section "Device"
2 | Identifier "Device0"
3 | Driver "intel"
4 | Option "AccelMethod" "sna"
5 | Option "TearFree" "true"
6 | Option "DRI" "3"
7 | EndSection
--------------------------------------------------------------------------------
/data/20-gpd-pocket3-intel.conf:
--------------------------------------------------------------------------------
1 | Section "Device"
2 | Identifier "Device0"
3 | Driver "intel"
4 | Option "AccelMethod" "sna"
5 | Option "TearFree" "true"
6 | Option "DRI" "1"
7 | EndSection
8 |
--------------------------------------------------------------------------------
/data/20-topjoy-falcon-intel.conf:
--------------------------------------------------------------------------------
1 | Section "Device"
2 | Identifier "Device0"
3 | Driver "intel"
4 | Option "AccelMethod" "sna"
5 | Option "TearFree" "true"
6 | Option "DRI" "3"
7 | EndSection
--------------------------------------------------------------------------------
/data/40-gpd-micropc-monitor.conf:
--------------------------------------------------------------------------------
1 | # GPD MicroPC (modesetting)
2 | Section "Monitor"
3 | Identifier "DSI-1"
4 | Option "Rotate" "right"
5 | EndSection
6 |
7 | # GPD MicroPC (xorg-video-intel)
8 | Section "Monitor"
9 | Identifier "DSI1"
10 | Option "Rotate" "right"
11 | EndSection
--------------------------------------------------------------------------------
/data/40-gpd-pocket-monitor.conf:
--------------------------------------------------------------------------------
1 | # GPD Pocket (modesetting)
2 | Section "Monitor"
3 | Identifier "DSI-1"
4 | Option "Rotate" "right"
5 | EndSection
6 |
7 | # GPD Pocket (xorg-video-intel)
8 | Section "Monitor"
9 | Identifier "DSI1"
10 | Option "Rotate" "right"
11 | EndSection
--------------------------------------------------------------------------------
/data/40-gpd-pocket2-monitor.conf:
--------------------------------------------------------------------------------
1 | # GPD Pocket2 (modesetting)
2 | Section "Monitor"
3 | Identifier "eDP-1"
4 | Option "Rotate" "right"
5 | EndSection
6 |
7 | # GPD Pocket2 (xorg-video-intel)
8 | Section "Monitor"
9 | Identifier "eDP1"
10 | Option "Rotate" "right"
11 | EndSection
--------------------------------------------------------------------------------
/data/40-gpd-pocket3-monitor.conf:
--------------------------------------------------------------------------------
1 | # GPD Pocket 3 (modesetting)
2 | Section "Monitor"
3 | Identifier "DSI-1"
4 | Option "Rotate" "right"
5 | EndSection
6 |
7 | # GPD Pocket 3 (xorg-video-intel)
8 | Section "Monitor"
9 | Identifier "DSI1"
10 | Option "Rotate" "right"
11 | EndSection
12 |
--------------------------------------------------------------------------------
/data/40-gpd-win-max-monitor.conf:
--------------------------------------------------------------------------------
1 | # GPD WIN Max (modesetting)
2 | Section "Monitor"
3 | Identifier "eDP-1"
4 | Option "Rotate" "right"
5 | EndSection
6 |
7 | Section "Monitor"
8 | Identifier "eDP1"
9 | Option "Rotate" "right"
10 | EndSection
11 |
--------------------------------------------------------------------------------
/data/40-gpd-win2-monitor.conf:
--------------------------------------------------------------------------------
1 | # GPD WIN 2 (modesetting)
2 | Section "Monitor"
3 | Identifier "eDP-1"
4 | Option "Rotate" "right"
5 | EndSection
6 |
7 | # GPD WIN 2 (xorg-video-intel)
8 | Section "Monitor"
9 | Identifier "eDP1"
10 | Option "Rotate" "right"
11 | EndSection
12 |
--------------------------------------------------------------------------------
/data/40-gpd-win3-monitor.conf:
--------------------------------------------------------------------------------
1 | # GPD WIN 3 (modesetting)
2 | Section "Monitor"
3 | Identifier "DSI-1"
4 | Option "Rotate" "right"
5 | EndSection
6 |
7 | # GPD WIN 3 (xorg-video-intel)
8 | Section "Monitor"
9 | Identifier "DSI1"
10 | Option "Rotate" "right"
11 | EndSection
12 |
--------------------------------------------------------------------------------
/data/40-topjoy-falcon-monitor.conf:
--------------------------------------------------------------------------------
1 | # GPD Pocket (modesetting)
2 | Section "Monitor"
3 | Identifier "DSI-1"
4 | Option "Rotate" "right"
5 | EndSection
6 |
7 | # GPD Pocket (xorg-video-intel)
8 | Section "Monitor"
9 | Identifier "DSI1"
10 | Option "Rotate" "right"
11 | EndSection
--------------------------------------------------------------------------------
/data/61-gpd-pocket3-sensor-local.hwdb:
--------------------------------------------------------------------------------
1 | sensor:modalias:*
2 | ACCEL_MOUNT_MATRIX=-1, 0, 0; 0, 1, 0; 1, 0, 0
3 |
--------------------------------------------------------------------------------
/data/61-gpd-win-max-sensor-local.hwdb:
--------------------------------------------------------------------------------
1 | evdev:atkbd:dmi:bvn*:bvr*:bd*:svnGPD:pnG1619-01:pvr*
2 | KEYBOARD_KEY_a0=!mute
3 |
--------------------------------------------------------------------------------
/data/61-gpd-win3-sensor-local.hwdb:
--------------------------------------------------------------------------------
1 | sensor:modalias:*
2 | ACCEL_MOUNT_MATRIX=-1, 0, 0; 0, 1, 0; 1, 0, 0
3 |
--------------------------------------------------------------------------------
/data/61-topjoy-falcon-sensor-local.hwdb:
--------------------------------------------------------------------------------
1 | sensor:modalias:*
2 | ACCEL_MOUNT_MATRIX=-1, 0, 0; 0, 1, 0; 1, 0, 0
3 |
--------------------------------------------------------------------------------
/data/80-gpd-micropc-trackpoint.conf:
--------------------------------------------------------------------------------
1 | Section "InputClass"
2 | Identifier "GPD MicroPC touchpad"
3 | MatchProduct "AMR-4630-XXX-0- 0-1023 USB KEYBOARD Mouse"
4 | MatchIsPointer "on"
5 | Driver "libinput"
6 | Option "AccelSpeed" "1"
7 | Option "MiddleEmulation" "1"
8 | Option "ScrollButton" "2"
9 | Option "ScrollMethod" "button"
10 | EndSection
11 |
12 | Section "InputClass"
13 | Identifier "GPD MicroPC touchpad v2"
14 | MatchProduct "SINO WEALTH 唰匀䈀 䬀攀礀戀漀愀爀搀 Mouse"
15 | MatchIsPointer "on"
16 | Driver "libinput"
17 | Option "AccelSpeed" "1"
18 | Option "MiddleEmulation" "1"
19 | Option "ScrollButton" "2"
20 | Option "ScrollMethod" "button"
21 | EndSection
22 |
--------------------------------------------------------------------------------
/data/80-gpd-pocket-trackpoint.conf:
--------------------------------------------------------------------------------
1 | Section "InputClass"
2 | Identifier "GPD Pocket trackpoint"
3 | MatchProduct "SINO WEALTH Gaming Keyboard"
4 | MatchIsPointer "on"
5 | Driver "libinput"
6 | Option "MiddleEmulation" "1"
7 | Option "ScrollButton" "3"
8 | Option "ScrollMethod" "button"
9 | Option "TransformationMatrix" "2 0 0 0 2 0 0 0 1"
10 | Option "AccelSpeed" "1"
11 | EndSection
12 |
--------------------------------------------------------------------------------
/data/80-gpd-pocket2-trackpoint.conf:
--------------------------------------------------------------------------------
1 | Section "InputClass"
2 | Identifier "GPD Pocket 2 trackpoint"
3 | MatchProduct "HAILUCK CO.,LTD USB KEYBOARD Mouse"
4 | MatchIsPointer "on"
5 | Driver "libinput"
6 | Option "MiddleEmulation" "1"
7 | Option "ScrollButton" "3"
8 | Option "ScrollMethod" "button"
9 | EndSection
10 |
--------------------------------------------------------------------------------
/data/80-gpd-pocket3-trackpoint.conf:
--------------------------------------------------------------------------------
1 | Section "InputClass"
2 | Identifier "GPD Pocket 3 touchpad"
3 | MatchProduct "HAILUCK CO.,LTD USB KEYBOARD Mouse"
4 | MatchIsPointer "on"
5 | Driver "libinput"
6 | Option "AccelSpeed" "1"
7 | Option "MiddleEmulation" "1"
8 | Option "ScrollButton" "2"
9 | Option "ScrollMethod" "button"
10 | EndSection
11 |
--------------------------------------------------------------------------------
/data/80-topjoy-falcon-trackpoint.conf:
--------------------------------------------------------------------------------
1 | Section "InputClass"
2 | Identifier "TopJoy Falcon trackpoint"
3 | MatchProduct "HAILUCK CO.,LTD USB KEYBOARD Mouse"
4 | MatchIsPointer "on"
5 | Driver "libinput"
6 | Option "MiddleEmulation" "1"
7 | Option "ScrollButton" "3"
8 | Option "ScrollMethod" "button"
9 | EndSection
--------------------------------------------------------------------------------
/data/90-falcon-topjoy.gschema.override:
--------------------------------------------------------------------------------
1 | [x.dm.slick-greeter]
2 | enable-hidpi='on'
3 |
4 | [org.ArcticaProject.arctica-greeter]
5 | enable-hidpi='on'
6 |
--------------------------------------------------------------------------------
/data/90-gpd-p2-max.gschema.override:
--------------------------------------------------------------------------------
1 | [x.dm.slick-greeter]
2 | enable-hidpi='on'
3 |
4 | [org.ArcticaProject.arctica-greeter]
5 | enable-hidpi='on'
6 |
7 | [org.mate.interface]
8 | window-scaling-factor=2
9 |
--------------------------------------------------------------------------------
/data/90-gpd-pocket.gschema.override:
--------------------------------------------------------------------------------
1 | [x.dm.slick-greeter]
2 | enable-hidpi='on'
3 |
4 | [org.ArcticaProject.arctica-greeter]
5 | enable-hidpi='on'
6 |
--------------------------------------------------------------------------------
/data/90-gpd-pocket2.gschema.override:
--------------------------------------------------------------------------------
1 | [x.dm.slick-greeter]
2 | enable-hidpi='on'
3 |
4 | [org.ArcticaProject.arctica-greeter]
5 | enable-hidpi='on'
6 |
--------------------------------------------------------------------------------
/data/90-gpd-pocket3.gschema.override:
--------------------------------------------------------------------------------
1 | [org.ArcticaProject.arctica-greeter]
2 | enable-hidpi='on'
3 |
--------------------------------------------------------------------------------
/data/99-gpd-pocket-touch.rules:
--------------------------------------------------------------------------------
1 | ACTION=="add|change", KERNEL=="event[0-9]*", ATTRS{name}=="Goodix Capacitive TouchScreen", ENV{LIBINPUT_CALIBRATION_MATRIX}="0 1 0 -1 0 1"
--------------------------------------------------------------------------------
/data/99-gpd-pocket2-touch.rules:
--------------------------------------------------------------------------------
1 | ACTION=="add|change", KERNEL=="event[0-9]*", ATTRS{name}=="Goodix Capacitive TouchScreen", ENV{LIBINPUT_CALIBRATION_MATRIX}="0 1 0 -1 0 1"
--------------------------------------------------------------------------------
/data/99-gpd-pocket3-touch.rules:
--------------------------------------------------------------------------------
1 | ACTION=="add", KERNEL=="event[0-9]*", ATTRS{name}=="GXTP7380:00 27C6:0113", ENV{LIBINPUT_CALIBRATION_MATRIX}="0 1 0 -1 0 1"
2 | ACTION=="add", KERNEL=="event[0-9]*", ATTRS{name}=="GXTP7380:00 27C6:0113 Stylus", ENV{LIBINPUT_CALIBRATION_MATRIX}="0 1 0 -1 0 1"
3 |
--------------------------------------------------------------------------------
/data/99-gpd-win-max-touch.rules:
--------------------------------------------------------------------------------
1 | ACTION=="add|change", KERNEL=="event[0-9]*", ATTRS{name}=="Goodix Capacitive TouchScreen", ENV{LIBINPUT_CALIBRATION_MATRIX}="0 1 0 -1 0 1"
--------------------------------------------------------------------------------
/data/99-gpd-win2-touch.rules:
--------------------------------------------------------------------------------
1 | ACTION=="add|change", KERNEL=="event[0-9]*", ATTRS{name}=="Goodix Capacitive TouchScreen", ENV{LIBINPUT_CALIBRATION_MATRIX}="0 1 0 -1 0 1"
--------------------------------------------------------------------------------
/data/99-gpd-win3-touch.rules:
--------------------------------------------------------------------------------
1 | ACTION=="add|change", KERNEL=="event[0-9]*", ATTRS{name}=="Goodix Capacitive TouchScreen", ENV{LIBINPUT_CALIBRATION_MATRIX}="0 1 0 -1 0 1"
--------------------------------------------------------------------------------
/data/99-topjoy-falcon-touch.rules:
--------------------------------------------------------------------------------
1 | ACTION=="add", KERNEL=="event[0-9]*", ATTRS{name}=="Goodix Capacitive TouchScreen", ENV{LIBINPUT_CALIBRATION_MATRIX}="0 1 0 -1 0 1"
2 |
--------------------------------------------------------------------------------
/data/alsa-gpd-pocket3.conf:
--------------------------------------------------------------------------------
1 | options snd-intel-dspcfg dsp_driver=1
2 |
--------------------------------------------------------------------------------
/data/alsa-gpd-win3.conf:
--------------------------------------------------------------------------------
1 | options snd-intel-dspcfg dsp_driver=1
2 |
--------------------------------------------------------------------------------
/data/brcmfmac4356-pcie.txt:
--------------------------------------------------------------------------------
1 | # Sample variables file for BCM94356Z NGFF 22x30mm iPA, iLNA board with PCIe for production package
2 | NVRAMRev=$Rev: 492104 $
3 | #4356 chip = 4354 A2 chip
4 | sromrev=11
5 | boardrev=0x1102
6 | boardtype=0x073e
7 | boardflags=0x02400201
8 | #0x2000 enable 2G spur WAR
9 | boardflags2=0x00802000
10 | boardflags3=0x0000000a
11 | #boardflags3 0x00000100 /* to read swctrlmap from nvram*/
12 | #define BFL3_5G_SPUR_WAR 0x00080000 /* enable spur WAR in 5G band */
13 | #define BFL3_AvVim 0x40000000 /* load AvVim from nvram */
14 | macaddr=00:90:4c:1a:10:01
15 | ccode=X2
16 | regrev=205
17 | antswitch=0
18 | pdgain5g=4
19 | pdgain2g=4
20 | tworangetssi2g=0
21 | tworangetssi5g=0
22 | paprdis=0
23 | femctrl=10
24 | vendid=0x14e4
25 | devid=0x43ec
26 | manfid=0x2d0
27 | #prodid=0x052e
28 | nocrc=1
29 | otpimagesize=502
30 | xtalfreq=37400
31 | rxgains2gelnagaina0=0
32 | rxgains2gtrisoa0=7
33 | rxgains2gtrelnabypa0=0
34 | rxgains5gelnagaina0=0
35 | rxgains5gtrisoa0=11
36 | rxgains5gtrelnabypa0=0
37 | rxgains5gmelnagaina0=0
38 | rxgains5gmtrisoa0=13
39 | rxgains5gmtrelnabypa0=0
40 | rxgains5ghelnagaina0=0
41 | rxgains5ghtrisoa0=12
42 | rxgains5ghtrelnabypa0=0
43 | rxgains2gelnagaina1=0
44 | rxgains2gtrisoa1=7
45 | rxgains2gtrelnabypa1=0
46 | rxgains5gelnagaina1=0
47 | rxgains5gtrisoa1=10
48 | rxgains5gtrelnabypa1=0
49 | rxgains5gmelnagaina1=0
50 | rxgains5gmtrisoa1=11
51 | rxgains5gmtrelnabypa1=0
52 | rxgains5ghelnagaina1=0
53 | rxgains5ghtrisoa1=11
54 | rxgains5ghtrelnabypa1=0
55 | rxchain=3
56 | txchain=3
57 | aa2g=3
58 | aa5g=3
59 | agbg0=2
60 | agbg1=2
61 | aga0=2
62 | aga1=2
63 | tssipos2g=1
64 | extpagain2g=2
65 | tssipos5g=1
66 | extpagain5g=2
67 | tempthresh=255
68 | tempoffset=255
69 | rawtempsense=0x1ff
70 | pa2ga0=-147,6192,-705
71 | pa2ga1=-161,6041,-701
72 | pa5ga0=-194,6069,-739,-188,6137,-743,-185,5931,-725,-171,5898,-715
73 | pa5ga1=-190,6248,-757,-190,6275,-759,-190,6225,-757,-184,6131,-746
74 | subband5gver=0x4
75 | pdoffsetcckma0=0x4
76 | pdoffsetcckma1=0x4
77 | pdoffset40ma0=0x0000
78 | pdoffset80ma0=0x0000
79 | pdoffset40ma1=0x0000
80 | pdoffset80ma1=0x0000
81 | maxp2ga0=76
82 | maxp5ga0=74,74,74,74
83 | maxp2ga1=76
84 | maxp5ga1=74,74,74,74
85 | cckbw202gpo=0x0000
86 | cckbw20ul2gpo=0x0000
87 | mcsbw202gpo=0x99644422
88 | mcsbw402gpo=0x99644422
89 | dot11agofdmhrbw202gpo=0x6666
90 | ofdmlrbw202gpo=0x0022
91 | mcsbw205glpo=0x88766663
92 | mcsbw405glpo=0x88666663
93 | mcsbw805glpo=0xbb666665
94 | mcsbw205gmpo=0xd8666663
95 | mcsbw405gmpo=0x88666663
96 | mcsbw805gmpo=0xcc666665
97 | mcsbw205ghpo=0xdc666663
98 | mcsbw405ghpo=0xaa666663
99 | mcsbw805ghpo=0xdd666665
100 | mcslr5glpo=0x0000
101 | mcslr5gmpo=0x0000
102 | mcslr5ghpo=0x0000
103 | sb20in40hrpo=0x0
104 | sb20in80and160hr5glpo=0x0
105 | sb40and80hr5glpo=0x0
106 | sb20in80and160hr5gmpo=0x0
107 | sb40and80hr5gmpo=0x0
108 | sb20in80and160hr5ghpo=0x0
109 | sb40and80hr5ghpo=0x0
110 | sb20in40lrpo=0x0
111 | sb20in80and160lr5glpo=0x0
112 | sb40and80lr5glpo=0x0
113 | sb20in80and160lr5gmpo=0x0
114 | sb40and80lr5gmpo=0x0
115 | sb20in80and160lr5ghpo=0x0
116 | sb40and80lr5ghpo=0x0
117 | dot11agduphrpo=0x0
118 | dot11agduplrpo=0x0
119 | phycal_tempdelta=255
120 | temps_period=15
121 | temps_hysteresis=15
122 | rssicorrnorm_c0=4,4
123 | rssicorrnorm_c1=4,4
124 | rssicorrnorm5g_c0=1,2,3,1,2,3,6,6,8,6,6,8
125 | rssicorrnorm5g_c1=1,2,3,2,2,2,7,7,8,7,7,8
--------------------------------------------------------------------------------
/data/gpd-micropc-monitors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 0
5 | 0
6 | 2
7 | yes
8 |
9 | right
10 | no
11 |
12 |
13 |
14 | DSI-1
15 | unknown
16 | unknown
17 | unknown
18 |
19 |
20 | 720
21 | 1280
22 | 60.021636962890625
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/data/gpd-micropc.cfg:
--------------------------------------------------------------------------------
1 | GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX} fbcon=rotate:1"
2 | GRUB_GFXMODE=720x1280x32
3 |
--------------------------------------------------------------------------------
/data/gpd-pocket-monitors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 0
5 | 0
6 | 2
7 | yes
8 |
9 | right
10 | no
11 |
12 |
13 |
14 | DSI-1
15 | unknown
16 | unknown
17 | unknown
18 |
19 |
20 | 1200
21 | 1920
22 | 60.021636962890625
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/data/gpd-pocket.cfg:
--------------------------------------------------------------------------------
1 | GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX} fbcon=rotate:1"
2 | GRUB_GFXMODE=1200x1920x32
3 |
--------------------------------------------------------------------------------
/data/gpd-pocket2-monitors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 0
5 | 0
6 | 2
7 | yes
8 |
9 | right
10 | no
11 |
12 |
13 |
14 | eDP-1
15 | unknown
16 | unknown
17 | unknown
18 |
19 |
20 | 1200
21 | 1920
22 | 60.021636962890625
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/data/gpd-pocket2.cfg:
--------------------------------------------------------------------------------
1 | GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX} fbcon=rotate:1"
2 | GRUB_GFXMODE=1200x1920x32
3 |
--------------------------------------------------------------------------------
/data/gpd-pocket3-monitors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 0
5 | 0
6 | 2
7 | yes
8 |
9 | right
10 | no
11 |
12 |
13 |
14 | DSI-1
15 | unknown
16 | unknown
17 | unknown
18 |
19 |
20 | 1200
21 | 1920
22 | 60.021636962890625
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/data/gpd-pocket3.cfg:
--------------------------------------------------------------------------------
1 | GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX} fbcon=rotate:1 video=DSI-1:panel_orientation=right_side_up mem_sleep_default=s2idle"
2 | GRUB_GFXMODE=1200x1920x32
3 |
--------------------------------------------------------------------------------
/data/gpd-win-max-edid.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wimpysworld/umpc-ubuntu/ca4c945217b45136b63264e1629af5b2b5f08373/data/gpd-win-max-edid.bin
--------------------------------------------------------------------------------
/data/gpd-win-max-monitors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 0
5 | 0
6 | 2
7 | yes
8 |
9 | right
10 | no
11 |
12 |
13 |
14 | eDP-1
15 | unknown
16 | unknown
17 | unknown
18 |
19 |
20 | 800
21 | 1280
22 | 60.021636962890625
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/data/gpd-win-max-new.cfg:
--------------------------------------------------------------------------------
1 | GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX} fbcon=rotate:1 video=eDP-1:800x1280"
2 | GRUB_GFXMODE=800x1280x32
3 |
--------------------------------------------------------------------------------
/data/gpd-win-max.cfg:
--------------------------------------------------------------------------------
1 | GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX} fbcon=rotate:1 video=eDP-1:800x1280 drm.edid_firmware=eDP-1:edid/gpd-win-max-edid.bin"
2 | GRUB_GFXMODE=800x1280x32
3 |
--------------------------------------------------------------------------------
/data/gpd-win2-monitors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 0
5 | 0
6 | 2
7 | yes
8 |
9 | right
10 | no
11 |
12 |
13 |
14 | eDP-1
15 | unknown
16 | unknown
17 | unknown
18 |
19 |
20 | 720
21 | 1280
22 | 60.021636962890625
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/data/gpd-win2.cfg:
--------------------------------------------------------------------------------
1 | GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX} fbcon=rotate:1 video=eDP-1:panel_orientation=right_side_up mem_sleep_default=s2idle"
2 | GRUB_GFXMODE=720x1280x32
3 |
--------------------------------------------------------------------------------
/data/gpd-win3-monitors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 0
5 | 0
6 | 2
7 | yes
8 |
9 | right
10 | no
11 |
12 |
13 |
14 | DSI-1
15 | unknown
16 | unknown
17 | unknown
18 |
19 |
20 | 720
21 | 1280
22 | 60.000682830810547
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/data/gpd-win3.cfg:
--------------------------------------------------------------------------------
1 | GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX} fbcon=rotate:1 video=DSI-1:panel_orientation=right_side_up mem_sleep_default=s2idle"
2 | GRUB_GFXMODE=720x1280x32
3 |
--------------------------------------------------------------------------------
/data/topjoy-falcon-monitors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 0
5 | 0
6 | 2
7 | yes
8 |
9 | right
10 | no
11 |
12 |
13 |
14 | DSI-1
15 | unknown
16 | unknown
17 | unknown
18 |
19 |
20 | 1200
21 | 1920
22 | 60.021636962890625
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/data/topjoy-falcon.cfg:
--------------------------------------------------------------------------------
1 | GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX} fbcon=rotate:1 video=DSI-1:panel_orientation=right_side_up"
2 | GRUB_GFXMODE=1200x1920x32
3 |
--------------------------------------------------------------------------------
/data/umpc-display-rotate.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022 Martin Wimpress
3 | *
4 | * orientation_changed() adapted from the sensorfw package
5 | * Copyright (C) 2009-2010 Nokia Corporation
6 | * Authors:
7 | * Üstün Ergenoglu
8 | * Timo Rongas
9 | * Lihan Guo
10 | *
11 | * gcc -O2 umpc-display-rotate.c -o umpc-display-rotate -lm
12 | *
13 | */
14 |
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 |
23 | #define NORMAL 0
24 | #define INVERTED 1
25 | #define RIGHT 2
26 | #define LEFT 3
27 |
28 | static const char *orientations[] = {
29 | "normal",
30 | "inverted",
31 | "right",
32 | "left",
33 | NULL
34 | };
35 |
36 | static const char *transforms[] = {
37 | "1 0 0 0 1 0 0 0 1",
38 | "-1 0 1 0 -1 1 0 0 1",
39 | "0 1 0 -1 0 1 0 0 1",
40 | "0 -1 1 1 0 0 0 0 1",
41 | NULL
42 | };
43 |
44 | static const char touchy[][48] = {
45 | "GXTP7380:00 27C6:0113", //GPD Pocket 3
46 | "GXTP7380:00 27C6:0113 Stylus Pen (0)", //GPD Pocket 3
47 | "GXTP7380:00 27C6:0113 Stylus Eraser (0)", //GPD Pocket 3
48 | "Goodix Capacitive TouchScreen" //TopJoy Falcon
49 | };
50 |
51 | static const char screens[][8] = {
52 | "DSI1" //GPD Pocket 3 & TopJoy Falcon
53 | };
54 |
55 | #define RADIANS_TO_DEGREES 180.0/M_PI
56 | #define SAME_AXIS_LIMIT 5
57 | #define THRESHOLD_LANDSCAPE 35
58 | #define THRESHOLD_PORTRAIT 35
59 |
60 | /* First apply scale to get m/s², then
61 | * convert to 1G ~= 256 as the code expects */
62 | #define SCALE(a) ((int) ((double) in_##a * scale * 256.0 / 9.81))
63 |
64 | int orientation_changed(const double in_x, const double in_y, const double in_z,
65 | const double scale, int *current_orientation) {
66 | int x, y, z;
67 | int portrait_rotation;
68 | int landscape_rotation;
69 | int new_orientation = RIGHT;
70 |
71 | /* this code expects 1G ~= 256 */
72 | x = SCALE(x);
73 | y = SCALE(y);
74 | z = SCALE(z);
75 |
76 | portrait_rotation = round(atan2(x, sqrt(y * y + z * z)) * RADIANS_TO_DEGREES);
77 | landscape_rotation = round(atan2(y, sqrt(x * x + z * z)) * RADIANS_TO_DEGREES);
78 |
79 | /* Don't change orientation if we are on the common border of two thresholds */
80 | if (abs(portrait_rotation) > THRESHOLD_PORTRAIT && abs(landscape_rotation) > THRESHOLD_LANDSCAPE) {
81 | return 0;
82 | }
83 |
84 | /* Portrait check */
85 | if (abs(portrait_rotation) > THRESHOLD_PORTRAIT) {
86 | new_orientation = (portrait_rotation > 0) ? RIGHT : LEFT;
87 |
88 | /* Some threshold to switching between portrait modes */
89 | if (*current_orientation == RIGHT || *current_orientation == LEFT) {
90 | if (abs(portrait_rotation) < SAME_AXIS_LIMIT) {
91 | new_orientation = *current_orientation;
92 | }
93 | }
94 | } else {
95 | /* Landscape check */
96 | if (abs(landscape_rotation) > THRESHOLD_LANDSCAPE) {
97 | new_orientation = (landscape_rotation > 0) ? INVERTED : NORMAL;
98 |
99 | /* Some threshold to switching between landscape modes */
100 | if (*current_orientation == INVERTED || *current_orientation == NORMAL) {
101 | if (abs(landscape_rotation) < SAME_AXIS_LIMIT) {
102 | new_orientation = *current_orientation;
103 | }
104 | }
105 | }
106 | }
107 |
108 | if (*current_orientation != new_orientation) {
109 | *current_orientation = new_orientation;
110 | return 1;
111 | }
112 | return 0;
113 | }
114 |
115 | char* concat(const char *s1, const char *s2) {
116 | char *new = malloc(strlen(s1) + strlen(s2) + 1); // +1 for the null-terminator
117 | strcpy(stpcpy(new, s1), s2);
118 | return new;
119 | }
120 |
121 | // TODO: Only set properties of active devices
122 | void rotate_touch(int orientation) {
123 | char cmd[384];
124 |
125 | // No checking if the device are present as xinput does "the right thing".
126 | for (size_t i = 0; i < sizeof(touchy) / sizeof(touchy[0]); i++) {
127 | fprintf(stdout, " Rotating Touch: %s (%s)\n", touchy[i], orientations[orientation]);
128 | sprintf(cmd, "xinput set-prop \"%s\" \"Coordinate Transformation Matrix\" %s 2>/dev/null", touchy[i], transforms[orientation]);
129 | //fprintf(stderr, " %s\n", cmd);
130 | int status = system(cmd);
131 | }
132 | }
133 |
134 | // TODO: Only rotate connected displays
135 | void rotate(int orientation) {
136 | char cmd[64];
137 | int status = 0;
138 |
139 | rotate_touch(orientation);
140 |
141 | // Iterate over the supported internal displays; do not rotate external displays
142 | for (size_t i = 0; i < sizeof(screens) / sizeof(screens[0]); i++) {
143 | // Blank the screen while the rotation happens
144 | sprintf(cmd, "xrandr --output %s --brightness 0", screens[i]);
145 | status = system(cmd);
146 |
147 | fprintf(stdout, " Rotating Screen: %s (%s)\n", screens[i], orientations[orientation]);
148 | sprintf(cmd, "xrandr --output %s --rotate %s", screens[i], orientations[orientation]);
149 | status = system(cmd);
150 |
151 | sleep(1);
152 |
153 | sprintf(cmd, "xrandr --output %s --brightness 1", screens[i]);
154 | status = system(cmd);
155 | }
156 | }
157 |
158 | double read_iio(char const *iio_dev, char const *sensor) {
159 | char content[32];
160 | char *fname = concat(iio_dev, sensor);
161 | double value = 0.0;
162 |
163 | FILE *fp = fopen(fname, "r");
164 | if (fp == NULL) {
165 | perror("Error opening file");
166 | }
167 |
168 | if (fgets(content, 32, fp) != NULL) {
169 | value = atof(content);
170 | }
171 |
172 | fclose(fp);
173 | free(fname);
174 | return value;
175 | }
176 |
177 | //TODO: Enumerate the iio:device path; don't hardcode
178 | char* get_accelerometer(void) {
179 | return "/sys/bus/iio/devices/iio:device0";
180 | }
181 |
182 | //TODO: Detect Wayland and abort.
183 | int main(int argc, char const *argv[]) {
184 | //2 is "right", the default orientation.
185 | //By initialising with 2, we avoid a needless rotation when the program starts
186 | int current_orientation = RIGHT;
187 | double raw_x, raw_y, raw_z, scale = 0.0;
188 |
189 | char* iio_dev = get_accelerometer();
190 |
191 | // Check that the IIO sensor is accessible
192 | DIR* dir = opendir(iio_dev);
193 | if (dir) {
194 | closedir(dir);
195 | fprintf(stdout, "Accelerometer: %s\n", iio_dev);
196 | } else {
197 | // IIO sensor directory does not exist/accessible
198 | fprintf(stdout, "Accelerometer: None.\n");
199 | return 1;
200 | }
201 |
202 | //Initialise the touch devices
203 | rotate_touch(current_orientation);
204 |
205 | // Get scaling factor
206 | scale = read_iio(iio_dev, "/in_accel_scale");
207 |
208 | // Poll the accelerometer
209 | for (;;) {
210 | raw_x = read_iio(iio_dev, "/in_accel_x_raw");
211 | raw_y = read_iio(iio_dev, "/in_accel_y_raw");
212 | raw_z = read_iio(iio_dev, "/in_accel_z_raw");
213 |
214 | if (orientation_changed(raw_x, raw_y, raw_z, scale, ¤t_orientation)) {
215 | rotate(current_orientation);
216 | } else {
217 | sleep(1.25);
218 | }
219 | }
220 | return 0;
221 | }
222 |
--------------------------------------------------------------------------------
/data/umpc-display-rotate.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Type=Application
3 | Name=Display Rotator
4 | Comment=Automatic screen/touch rotation for UMPCs
5 | Keywords=UMPC;display;screen;rotate;
6 | Icon=preferences-desktop-display
7 | Exec=umpc-display-rotate
8 | OnlyShowIn=MATE;XFCE;
9 | Terminal=false
10 | Categories=GTK;Settings;HardwareSettings;
11 | StartupNotify=false
12 | X-MATE-Autostart-Phase=Application
13 | X-MATE-Autostart-Notify=false
14 |
--------------------------------------------------------------------------------
/data/umpc-display-scaler:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | PRIMARY_RESOLUTION=$(xrandr | grep "connected primary" | cut -d' ' -f4 | cut -d'+' -f1 | sed 's/ //g')
4 | case "${PRIMARY_RESOLUTION}" in
5 | 1920x1200)
6 | NOTIFY="Fractional scaling enabled for "
7 | SCALE=0.64;;
8 | *)
9 | NOTIFY="Fractional scaling disabled for "
10 | SCALE=1;;
11 | esac
12 |
13 | PRIMARY_DISPLAY=$(xrandr | grep "connected primary" | cut -d' ' -f1 | sed 's/ //g')
14 | case "${PRIMARY_DISPLAY}" in
15 | eDP1|eDP-1|DSI1|DSI-1)
16 | xrandr --output "${PRIMARY_DISPLAY}" --brightness 0
17 | xrandr --output "${PRIMARY_DISPLAY}" --scale "${SCALE}x${SCALE}"
18 | sleep 0.85
19 | xrandr --output "${PRIMARY_DISPLAY}" --brightness 1
20 | notify-send --expire-time=5000 --icon=info "${NOTIFY} (${PRIMARY_DISPLAY})"
21 | ;;
22 | *)
23 | notify-send --expire-time=5000 --icon=error "The primary display (${PRIMARY_DISPLAY}) is not compatible with UMPC Display Scaler."
24 | ;;
25 | esac
26 |
--------------------------------------------------------------------------------
/data/umpc-display-scaler.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Type=Application
3 | Name=Display Scaler
4 | Comment=Toggle fractional scaling for UMPC internal displays
5 | Keywords=UMPC;display;screen;scaling;
6 | Icon=preferences-desktop-display
7 | Exec=umpc-display-scaler
8 | OnlyShowIn=MATE;XFCE;
9 | Terminal=false
10 | Categories=GTK;Settings;HardwareSettings;
11 | StartupNotify=false
12 | X-MATE-Autostart-Phase=Application
13 | X-MATE-Autostart-Notify=false
14 |
--------------------------------------------------------------------------------
/data/umpc-display-scaler.service:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=UMPC display scaler
3 | After=oem-config.service
4 |
5 | [Service]
6 | Type=oneshot
7 | ExecStart=/usr/bin/umpc-display-scaler
8 |
9 | [Install]
10 | WantedBy=oem-config.service
11 |
--------------------------------------------------------------------------------
/gpd-pockets.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wimpysworld/umpc-ubuntu/ca4c945217b45136b63264e1629af5b2b5f08373/gpd-pockets.jpg
--------------------------------------------------------------------------------
/umpc-ubuntu-respin-all.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # Make sure we are a regular user
4 | if [ "$(id -u)" -eq 0 ]; then
5 | echo "ERROR! You must be a regular user to run $(basename "${0}")"
6 | exit 1
7 | fi
8 |
9 | sudo true
10 | for ISO_IN in ubuntu-mate-20.04.4-desktop-amd64.iso ubuntu-mate-22.04-desktop-amd64.iso; do
11 | for UMPC in gpd-pocket gpd-pocket2 gpd-pocket3 gpd-micropc gpd-p2-max gpd-win2 gpd-win-max topjoy-falcon; do
12 | echo "Making ${ISO_IN} for ${UMPC}"
13 | ISO_OUT=$(basename "${ISO_IN}" | sed "s/\.iso/-${UMPC}\.iso/")
14 | if [ ! -e "${ISO_OUT}" ]; then
15 | sudo ./umpc-ubuntu-respin.sh -d ${UMPC} "${ISO_IN}"
16 | else
17 | echo " - ${ISO_OUT} is already built."
18 | fi
19 | if [ -x "${HOME}/Scripts/mate/sign_image.sh" ]; then
20 | if [ ! -e "${ISO_OUT}.sha256" ]; then
21 | "${HOME}"/Scripts/mate/sign_image.sh "${ISO_OUT}"
22 | else
23 | echo " - ${ISO_OUT} is already signed."
24 | fi
25 | else
26 | echo " - Image signer not found."
27 | fi
28 | echo
29 | done
30 | done
31 |
--------------------------------------------------------------------------------
/umpc-ubuntu-respin.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | function usage() {
4 | echo
5 | echo "NAME"
6 | echo " $(basename "${0}") - Apply GPD/TopJoy device modifications to an Ubuntu .iso image."
7 | echo
8 | echo "SYNOPSIS"
9 | echo " $(basename "${0}") [ options ] [ ubuntu iso image ]"
10 | echo
11 | echo "OPTIONS"
12 | echo " -d"
13 | echo " device modifications to apply to the iso image, can be 'gpd-pocket', 'gpd-pocket2', 'gpd-pocket3', 'gpd-micropc', 'gpd-p2-max', 'gpd-win2', 'gpd-win3', 'gpd-win-max' or 'topjoy-falcon'"
14 | echo
15 | echo " -h"
16 | echo " display this help and exit"
17 | echo
18 | exit
19 | }
20 |
21 | # Copy file from /data to it's intended location
22 | function inject_data() {
23 | local TARGET_FILE="${1}"
24 | local TARGET_DIR=$(dirname "${TARGET_FILE}")
25 | if [ -n "${2}" ] && [ -f "${2}" ]; then
26 | local SOURCE_FILE="${2}"
27 | else
28 | local SOURCE_FILE="data/$(basename ${TARGET_FILE})"
29 | fi
30 |
31 | if [ -f "${SOURCE_FILE}" ]; then
32 | echo " - Injecting ${TARGET_FILE}"
33 | if [ ! -d "${TARGET_DIR}" ]; then
34 | mkdir -p "${TARGET_DIR}"
35 | fi
36 | cp "${SOURCE_FILE}" "${TARGET_FILE}"
37 |
38 | # Rename the GDM3 monitors configuration
39 | if [[ "${TARGET_FILE}" == *"monitors.xml"* ]]; then
40 | mv -v "${TARGET_FILE}" "${TARGET_DIR}/monitors.xml"
41 | fi
42 | fi
43 | }
44 |
45 | function clean_up() {
46 | echo "Cleaning up..."
47 | echo " - ${MNT_IN}"
48 | rm -rf "${MNT_IN}"
49 | echo " - ${MNT_OUT}"
50 | rm -rf "${MNT_OUT}"
51 | }
52 |
53 | # Make sure we are root.
54 | if [ "$(id -u)" -ne 0 ]; then
55 | echo "ERROR! You must be root to run $(basename "${0}")"
56 | exit 1
57 | fi
58 |
59 | if [ ! -f /usr/bin/xorriso ]; then
60 | echo "ERROR! Unable to find /usr/bin/xorriso. Installing now..."
61 | apt-get -y install xorriso
62 | fi
63 |
64 | if [ ! -f /usr/bin/unsquashfs ]; then
65 | echo "ERROR! Unable to find /usr/bin/unsquashfs. Installing now..."
66 | apt-get -y install squashfs-tools
67 | fi
68 |
69 |
70 | UMPC=""
71 | OPTSTRING=d:h
72 | while getopts ${OPTSTRING} OPT; do
73 | case ${OPT} in
74 | d) UMPC="${OPTARG}";;
75 | h) usage;;
76 | *) usage;;
77 | esac
78 | done
79 | shift "$((OPTIND - 1))"
80 | ISO_IN="${1}"
81 |
82 | if [ -z "${UMPC}" ]; then
83 | echo "ERROR! You must supply the name of the device you want to apply modifications for."
84 | usage
85 | fi
86 |
87 | case "${UMPC}" in
88 | gpd-pocket|gpd-pocket2|gpd-pocket3|gpd-micropc|gpd-p2-max|gpd-win2|gpd-win3|gpd-win-max|topjoy-falcon) true;;
89 | *) echo "ERROR! Unknown device name given."
90 | usage;;
91 | esac
92 |
93 | if [ -z "${ISO_IN}" ]; then
94 | echo "ERROR! You must provide the filename of an Ubuntu iso image."
95 | usage
96 | fi
97 |
98 | if [ ! -f "${ISO_IN}" ]; then
99 | echo "ERROR! Can not access ${ISO_IN}."
100 | exit
101 | fi
102 |
103 | ISO_OUT=$(basename "${ISO_IN}" | sed "s/\.iso/-${UMPC}\.iso/")
104 | if [ -f "${ISO_OUT}" ]; then
105 | rm -f "${ISO_OUT}"
106 | fi
107 |
108 | MNT_IN="${HOME}/iso_in"
109 | MNT_OUT="${HOME}/iso_out"
110 | SQUASH_IN="${MNT_IN}/casper/filesystem.squashfs"
111 | SQUASH_OUT="${MNT_OUT}/casper/squashfs-root"
112 | XORG_CONF_PATH="${SQUASH_OUT}/usr/share/X11/xorg.conf.d"
113 | INTEL_CONF="${XORG_CONF_PATH}/20-${UMPC}-intel.conf"
114 | MODPROBE_CONF="${SQUASH_OUT}/etc/modprobe.d/alsa-${UMPC}.conf"
115 | MONITOR_CONF="${XORG_CONF_PATH}/40-${UMPC}-monitor.conf"
116 | MONITORS_XML="${SQUASH_OUT}/var/lib/gdm3/.config/${UMPC}-monitors.xml"
117 | TRACKPOINT_CONF="${XORG_CONF_PATH}/80-${UMPC}-trackpoint.conf"
118 | TOUCH_RULES="${SQUASH_OUT}/etc/udev/rules.d/99-${UMPC}-touch.rules"
119 | GRUB_DEFAULT_CONF="${SQUASH_OUT}/etc/default/grub"
120 | GRUB_D_CONF="${SQUASH_OUT}/etc/default/grub.d/${UMPC}.cfg"
121 | GRUB_BOOT_CONF="${MNT_OUT}/boot/grub/grub.cfg"
122 | GRUB_LOOPBACK_CONF="${MNT_OUT}/boot/grub/loopback.cfg"
123 | CONSOLE_CONF="${SQUASH_OUT}/etc/default/console-setup"
124 | GSCHEMA_OVERRIDE="${SQUASH_OUT}/usr/share/glib-2.0/schemas/90-${UMPC}.gschema.override"
125 | HWDB_CONF="${SQUASH_OUT}/etc/udev/hwdb.d/61-${UMPC}-sensor-local.hwdb"
126 |
127 | # Copy the contents of the ISO
128 | mkdir -p "${MNT_IN}"
129 | mkdir -p "${MNT_OUT}"
130 | mount -o loop "${ISO_IN}" "${MNT_IN}"
131 | if [ $? -ne 0 ]; then
132 | echo "ERROR! Unable to mount ${ISO_IN}"
133 | clean_up
134 | exit 1
135 | fi
136 |
137 | if [ -d "${MNT_IN}/isolinux" ]; then
138 | ISO_BUILD="old"
139 | if [ ! -f /usr/lib/ISOLINUX/isohdpfx.bin ]; then
140 | echo "ERROR! Unable to find /usr/lib/ISOLINUX/isohdpfx.bin. Installing now..."
141 | apt-get -y install isolinux
142 | fi
143 | else
144 | ISO_BUILD="new"
145 | if [ ! -f /usr/share/cd-boot-images-amd64/images/boot/grub/efi.img ]; then
146 | echo "ERROR! Unable to find /usr/share/cd-boot-images-amd64/images/boot/grub/efi.img. Installing now..."
147 | apt-get -y install cd-boot-images-amd64
148 | fi
149 | fi
150 |
151 | if [ -f "${MNT_IN}/.disk/info" ] && [ -f "${MNT_IN}/casper/filesystem.squashfs" ]; then
152 | FLAVOUR=$(cut -d' ' -f1 < "${MNT_IN}/.disk/info")
153 | VERSION=$(cut -d' ' -f2 < "${MNT_IN}/.disk/info")
154 | CODENAME=$(cut -d'"' -f2 < "${MNT_IN}/.disk/info")
155 | echo "Modifying ${FLAVOUR} ${VERSION} (${CODENAME}) for the ${UMPC}"
156 |
157 | rsync -aHAXx --delete --quiet \
158 | --exclude=/casper/filesystem.squashfs \
159 | --exclude=/casper/filesystem.squashfs.gpg \
160 | --exclude=/md5sum.txt \
161 | "${MNT_IN}/" "${MNT_OUT}/" 2>&1 >/dev/null
162 |
163 | # Extract the contents of the squashfs
164 | unsquashfs -f -d "${SQUASH_OUT}" "${SQUASH_IN}"
165 | umount -l "${MNT_IN}"
166 | else
167 | echo "ERROR! This doesn't look like an Ubuntu iso image."
168 | umount -l "${MNT_IN}"
169 | clean_up
170 | exit 1
171 | fi
172 |
173 | # Check versions
174 | case ${VERSION} in
175 | 14*|16*|18*)
176 | echo "ERROR! Only Ubuntu 20.04 or newer is supported."
177 | exit 1
178 | ;;
179 | esac
180 |
181 | # Some device have require specific Ubuntu releases.
182 | case "${UMPC}" in
183 | gpd-pocket3)
184 | case ${VERSION} in
185 | 20*|21.04)
186 | echo "ERROR! GPD Pocket 3 is only supported by Ubuntu 21.10 and newer."
187 | exit 1
188 | ;;
189 | esac
190 | ;;
191 | gpd-win-max)
192 | case ${VERSION} in
193 | 22.04*)
194 | GRUB_D_CONF="${SQUASH_OUT}/etc/default/grub.d/${UMPC}-new.cfg"
195 | echo "ERROR! GPD Win Max is only supported by Ubuntu 20.04 to 21.10."
196 | exit 1
197 | ;;
198 | esac
199 | ;;
200 | esac
201 |
202 | # NOTE! Do not inject this configuration anymore. The defaults are sane.
203 | # Enable Intel SNA, DRI1/3 and TearFree.
204 | # inject_data "${INTEL_CONF}"
205 |
206 | # Rotate the monitor.
207 | inject_data "${MONITOR_CONF}"
208 | inject_data "${MONITORS_XML}"
209 |
210 | # Scroll while holding down the right track point button
211 | inject_data "${TRACKPOINT_CONF}"
212 |
213 | # Rotate the touchscreen.
214 | inject_data "${TOUCH_RULES}"
215 |
216 | # Configure kernel modules
217 | inject_data "${MODPROBE_CONF}"
218 |
219 | # Apply device specific gschema overrides
220 | inject_data "${GSCHEMA_OVERRIDE}"
221 |
222 | # Add device specific /etc/grub.d configuration
223 | inject_data "${GRUB_D_CONF}"
224 |
225 | # Device specific tweaks
226 | case ${UMPC} in
227 | gpd-pocket)
228 | # Add BRCM4356 firmware configuration
229 | inject_data "${SQUASH_OUT}/lib/firmware/brcm/brcmfmac4356-pcie.txt"
230 |
231 | # Frame buffer rotation
232 | sed -i 's/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="fbcon=rotate:1/' "${GRUB_DEFAULT_CONF}"
233 | sed -i 's/quiet splash/fbcon=rotate:1 fsck.mode=skip quiet splash/g' "${GRUB_BOOT_CONF}"
234 | sed -i 's/quiet splash/fbcon=rotate:1 fsck.mode=skip quiet splash/g' "${GRUB_LOOPBACK_CONF}"
235 |
236 | # Increase console font size
237 | sed -i 's/FONTSIZE="8x16"/FONTSIZE="16x32"/' "${CONSOLE_CONF}"
238 |
239 | # Display scaler
240 | inject_data "${SQUASH_OUT}/usr/bin/umpc-display-scaler"
241 | inject_data "${SQUASH_OUT}/etc/xdg/autostart/umpc-display-scaler.desktop"
242 | inject_data "${SQUASH_OUT}/usr/share/applications/umpc-display-scaler.desktop"
243 | ;;
244 | gpd-pocket2)
245 | # Frame buffer rotation
246 | sed -i 's/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="fbcon=rotate:1/' "${GRUB_DEFAULT_CONF}"
247 | sed -i 's/quiet splash/fbcon=rotate:1 fsck.mode=skip quiet splash/g' "${GRUB_BOOT_CONF}"
248 | sed -i 's/quiet splash/fbcon=rotate:1 fsck.mode=skip quiet splash/g' "${GRUB_LOOPBACK_CONF}"
249 |
250 | # Increase console font size
251 | sed -i 's/FONTSIZE="8x16"/FONTSIZE="16x32"/' "${CONSOLE_CONF}"
252 |
253 | # Display scaler
254 | inject_data "${SQUASH_OUT}/usr/bin/umpc-display-scaler"
255 | inject_data "${SQUASH_OUT}/etc/xdg/autostart/umpc-display-scaler.desktop"
256 | inject_data "${SQUASH_OUT}/usr/share/applications/umpc-display-scaler.desktop"
257 | ;;
258 | gpd-pocket3)
259 | # Frame buffer rotation and s2idle by default.
260 | # s2idle is a temporary workaround
261 | # - Otherwise the screen will not turn back on after blanking if the system is busy.
262 | # - This issue also affects suspend feature.
263 | # - Patches are being worked on, more info here:
264 | # https://ubuntu-mate.community/t/gpd-pocket-3-s3-sleep-waiting-for-kernel-fix/25053/
265 | sed -i 's/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="fbcon=rotate:1 video=DSI-1:panel_orientation=right_side_up mem_sleep_default=s2idle/' "${GRUB_DEFAULT_CONF}"
266 | sed -i 's/quiet splash/fbcon=rotate:1 video=DSI-1:panel_orientation=right_side_up mem_sleep_default=s2idle fsck.mode=skip quiet splash/g' "${GRUB_BOOT_CONF}"
267 | sed -i 's/quiet splash/fbcon=rotate:1 video=DSI-1:panel_orientation=right_side_up mem_sleep_default=s2idle fsck.mode=skip quiet splash/g' "${GRUB_LOOPBACK_CONF}"
268 |
269 | # Increase console font size
270 | sed -i 's/FONTSIZE="8x16"/FONTSIZE="16x32"/' "${CONSOLE_CONF}"
271 |
272 | # Add automatic screen rotation
273 | gcc -O2 "data/umpc-display-rotate.c" -o "${SQUASH_OUT}/usr/bin/umpc-display-rotate" -lm
274 | inject_data "${SQUASH_OUT}/etc/xdg/autostart/umpc-display-rotate.desktop"
275 | inject_data "${HWDB_CONF}"
276 |
277 | # Display scaler
278 | inject_data "${SQUASH_OUT}/usr/bin/umpc-display-scaler"
279 | inject_data "${SQUASH_OUT}/etc/xdg/autostart/umpc-display-scaler.desktop"
280 | inject_data "${SQUASH_OUT}/usr/share/applications/umpc-display-scaler.desktop"
281 | ;;
282 | gpd-p2-max)
283 | # Increase console font size
284 | sed -i 's/FONTSIZE="8x16"/FONTSIZE="16x32"/' "${CONSOLE_CONF}"
285 | ;;
286 | gpd-micropc)
287 | # Frame buffer rotation
288 | sed -i 's/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="fbcon=rotate:1/' "${GRUB_DEFAULT_CONF}"
289 | sed -i 's/quiet splash/fbcon=rotate:1 fsck.mode=skip quiet splash/g' "${GRUB_BOOT_CONF}"
290 | sed -i 's/quiet splash/fbcon=rotate:1 fsck.mode=skip quiet splash/g' "${GRUB_LOOPBACK_CONF}"
291 | ;;
292 | gpd-win2)
293 | # Frame buffer rotation
294 | # s2idle is required to wake from suspend.
295 | sed -i 's/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="fbcon=rotate:1 video=eDP-1:panel_orientation=right_side_up mem_sleep_default=s2idle/' "${GRUB_DEFAULT_CONF}"
296 | sed -i 's/quiet splash/fbcon=rotate:1 video=eDP-1:panel_orientation=right_side_up mem_sleep_default=s2idle fsck.mode=skip quiet splash/g' "${GRUB_BOOT_CONF}"
297 | sed -i 's/quiet splash/fbcon=rotate:1 video=eDP-1:panel_orientation=right_side_up mem_sleep_default=s2idle fsck.mode=skip quiet splash/g' "${GRUB_LOOPBACK_CONF}"
298 | ;;
299 | gpd-win3)
300 | # Frame buffer rotation and s2idle by default.
301 | # s2idle is a temporary workaround
302 | # - Otherwise the screen will not turn back on after blanking if the system is busy.
303 | # - This issue also affects suspend feature.
304 | # - Patches are being worked on, more info here:
305 | # https://ubuntu-mate.community/t/gpd-pocket-3-s3-sleep-waiting-for-kernel-fix/25053/
306 | sed -i 's/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="fbcon=rotate:1 video=DSI-1:panel_orientation=right_side_up mem_sleep_default=s2idle/' "${GRUB_DEFAULT_CONF}"
307 | sed -i 's/quiet splash/fbcon=rotate:1 video=DSI-1:panel_orientation=right_side_up mem_sleep_default=s2idle fsck.mode=skip quiet splash/g' "${GRUB_BOOT_CONF}"
308 | sed -i 's/quiet splash/fbcon=rotate:1 video=DSI-1:panel_orientation=right_side_up mem_sleep_default=s2idle fsck.mode=skip quiet splash/g' "${GRUB_LOOPBACK_CONF}"
309 |
310 | # Might need a workaround for the touch screen.
311 | # > "My touch screen does work if I "modprobe -r goodix && modprobe goodix"
312 | # > after login, as opposed to adding it under /etc/modules-load.d."
313 | # See also: https://aur.archlinux.org/packages/goodix-gpdwin3-dkms/
314 | ;;
315 | gpd-win-max)
316 | # Add device specific EDID on Ubuntu 21.10 are earlier
317 | # https://patchwork.kernel.org/project/intel-gfx/cover/20210817204329.5457-1-anisse@astier.eu/#24416791
318 | case "${VERSION}" in
319 | 22*)
320 | sed -i "s/GRUB_CMDLINE_LINUX=\"/GRUB_CMDLINE_LINUX=\"fbcon=rotate:1 video=eDP-1:800x1280/" "${GRUB_DEFAULT_CONF}"
321 | sed -i "s/quiet splash/fbcon=rotate:1 video=eDP-1:800x1280 fsck.mode=skip quiet splash/g" "${GRUB_BOOT_CONF}"
322 | sed -i "s/quiet splash/fbcon=rotate:1 video=eDP-1:800x1280 fsck.mode=skip quiet splash/g" "${GRUB_LOOPBACK_CONF}"
323 | ;;
324 | *)
325 | inject_data "${SQUASH_OUT}/usr/lib/firmware/edid/${UMPC}-edid.bin"
326 | sed -i "s/GRUB_CMDLINE_LINUX=\"/GRUB_CMDLINE_LINUX=\"fbcon=rotate:1 video=eDP-1:800x1280 drm.edid_firmware=eDP-1:edid\/${UMPC}-edid.bin/" "${GRUB_DEFAULT_CONF}"
327 | sed -i "s/quiet splash/fbcon=rotate:1 video=eDP-1:800x1280 drm.edid_firmware=eDP-1:edid\/${UMPC}-edid.bin fsck.mode=skip quiet splash/g" "${GRUB_BOOT_CONF}"
328 | sed -i "s/quiet splash/fbcon=rotate:1 video=eDP-1:800x1280 drm.edid_firmware=eDP-1:edid\/${UMPC}-edid.bin fsck.mode=skip quiet splash/g" "${GRUB_LOOPBACK_CONF}"
329 | ;;
330 | esac
331 | ;;
332 | topjoy-falcon)
333 | # Frame buffer rotation
334 | sed -i 's/GRUB_CMDLINE_LINUX="/GRUB_CMDLINE_LINUX="fbcon=rotate:1 video=DSI-1:panel_orientation=right_side_up /' "${GRUB_DEFAULT_CONF}"
335 | sed -i 's/quiet splash/fbcon=rotate:1 video=DSI-1:panel_orientation=right_side_up fsck.mode=skip quiet splash/g' "${GRUB_BOOT_CONF}"
336 | sed -i 's/quiet splash/fbcon=rotate:1 video=DSI-1:panel_orientation=right_side_up fsck.mode=skip quiet splash/g' "${GRUB_LOOPBACK_CONF}"
337 |
338 | # Increase console font size
339 | sed -i 's/FONTSIZE="8x16"/FONTSIZE="16x32"/' "${CONSOLE_CONF}"
340 |
341 | # Add automatic screen rotation
342 | gcc -O2 "data/umpc-display-rotate.c" -o "${SQUASH_OUT}/usr/bin/umpc-display-rotate" -lm
343 | inject_data "${SQUASH_OUT}/etc/xdg/autostart/umpc-display-rotate.desktop"
344 | inject_data "${HWDB_CONF}"
345 |
346 | # Display scaler
347 | inject_data "${SQUASH_OUT}/usr/bin/umpc-display-scaler"
348 | inject_data "${SQUASH_OUT}/etc/xdg/autostart/umpc-display-scaler.desktop"
349 | inject_data "${SQUASH_OUT}/usr/share/applications/umpc-display-scaler.desktop"
350 | ;;
351 | *)
352 | echo "ERROR! No device configuration for ${UMPC}!"
353 | exit 1
354 | ;;
355 | esac
356 |
357 | #echo
358 | #echo "Modified : ${GRUB_DEFAULT_CONF}"
359 | #cat "${GRUB_DEFAULT_CONF}"
360 | #echo
361 |
362 | #echo
363 | #echo "Modified : ${GRUB_BOOT_CONF}"
364 | #cat "${GRUB_BOOT_CONF}"
365 | #echo
366 |
367 | #echo
368 | #echo "Modified : ${GRUB_LOOPBACK_CONF}"
369 | #cat "${GRUB_LOOPBACK_CONF}"
370 | #echo
371 |
372 | # Update filesystem size
373 | du -sx --block-size=1 "${SQUASH_OUT}" | cut -f1 > "${MNT_OUT}/casper/filesystem.size"
374 |
375 | # Repack squahsfs
376 | rm -f "${MNT_OUT}/casper/filesystem.squashfs" 2>/dev/null
377 | mksquashfs "${SQUASH_OUT}" "${MNT_OUT}/casper/filesystem.squashfs"
378 | echo "Cleaning up..."
379 | echo " - ${SQUASH_OUT}"
380 | rm -rf "${SQUASH_OUT}"
381 | sync
382 |
383 | # Collect md5sums
384 | find "${MNT_OUT}" -type f -print0 | xargs -0 md5sum | sed 's|'"${MNT_OUT}"'|\.|g' > "${MNT_OUT}/md5sum.txt"
385 |
386 | VOL_ID=$(echo "${FLAVOUR}-${VERSION}-${UMPC}" | cut -c1-31)
387 | rm -f "${ISO_OUT}" 2>/dev/null
388 |
389 | # Reference for new iso build:
390 | # - https://bugs.launchpad.net/ubuntu-cdimage/+bug/1886148
391 | # - From https://bugs.launchpad.net/ubuntu-cdimage/+bug/1886148/comments/195
392 | case ${ISO_BUILD} in
393 | old)
394 | xorriso \
395 | -as mkisofs \
396 | -r \
397 | -checksum_algorithm_iso md5,sha1 \
398 | -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin \
399 | -J \
400 | -l \
401 | -b isolinux/isolinux.bin \
402 | -c isolinux/boot.cat \
403 | -no-emul-boot \
404 | -boot-load-size 4 \
405 | -boot-info-table \
406 | -eltorito-alt-boot \
407 | -e boot/grub/efi.img \
408 | -no-emul-boot \
409 | -isohybrid-gpt-basdat \
410 | -isohybrid-apm-hfsplus \
411 | -volid "${VOL_ID}" \
412 | -o "${ISO_OUT}" "${MNT_OUT}/";;
413 | *)
414 | xorriso \
415 | -as mkisofs \
416 | -r \
417 | -checksum_algorithm_iso md5,sha1 \
418 | -J -joliet-long \
419 | -l \
420 | -b boot/grub/i386-pc/eltorito.img -no-emul-boot \
421 | -boot-load-size 4 \
422 | -boot-info-table \
423 | --grub2-boot-info \
424 | --grub2-mbr /usr/share/cd-boot-images-amd64/images/boot/grub/i386-pc/boot_hybrid.img \
425 | -append_partition 2 0xef /usr/share/cd-boot-images-amd64/images/boot/grub/efi.img \
426 | -appended_part_as_gpt -eltorito-alt-boot -e --interval\:appended_partition_2\:all\:\: -no-emul-boot \
427 | -partition_offset 16 /usr/share/cd-boot-images-amd64/tree \
428 | -V "${VOL_ID}" \
429 | -o "${ISO_OUT}" "${MNT_OUT}/";;
430 | esac
431 | chown -v "${SUDO_USER}":"${SUDO_USER}" "${ISO_OUT}"
432 | clean_up
433 |
--------------------------------------------------------------------------------
/umpc-ubuntu.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | # Set to either "gpd-pocket", "gpd-pocket2", "gpd-pocket3", "gpd-p2-max", "gpd-micropc", "gpd-win2", "gpd-win-max" or "topjoy-falcon"
4 | UMPC="gpd-pocket3"
5 | XORG_CONF_PATH="/usr/share/X11/xorg.conf.d"
6 | INTEL_CONF="${XORG_CONF_PATH}/20-${UMPC}-intel.conf"
7 | MODPROBE_CONF="/etc/modprobe.d/alsa-${UMPC}.conf"
8 | MONITOR_CONF="${XORG_CONF_PATH}/40-${UMPC}-monitor.conf"
9 | MONITORS_XML="/var/lib/gdm3/.config/${UMPC}-monitors.xml"
10 | TRACKPOINT_CONF="${XORG_CONF_PATH}/80-${UMPC}-trackpoint.conf"
11 | TOUCH_RULES="/etc/udev/rules.d/99-${UMPC}-touch.rules"
12 | BRCM4356_CONF="/lib/firmware/brcm/brcmfmac4356-pcie.txt"
13 | GRUB_DEFAULT_CONF="/etc/default/grub"
14 | GRUB_D_CONF="/etc/default/grub.d/${UMPC}.cfg"
15 | CONSOLE_CONF="/etc/default/console-setup"
16 | GSCHEMA_OVERRIDE="/usr/share/glib-2.0/schemas/90-${UMPC}.gschema.override"
17 | EDID="/lib/firmware/edid/${UMPC}-edid.bin"
18 | HWDB_CONF="/etc/udev/hwdb.d/61-${UMPC}-sensor-local.hwdb"
19 |
20 | # Copy file from /data to it's intended location
21 | function inject_data() {
22 | local SOURCE_FILE=""
23 | local TARGET_FILE="${1}"
24 | local TARGET_DIR=$(dirname "${TARGET_FILE}")
25 | if [ -n "${2}" ] && [ -f "${2}" ]; then
26 | SOURCE_FILE="${2}"
27 | else
28 | SOURCE_FILE="data/$(basename "${TARGET_FILE}")"
29 | fi
30 |
31 | if [ -f "${SOURCE_FILE}" ]; then
32 | echo " - Injecting ${TARGET_FILE}"
33 | if [ ! -d "${TARGET_DIR}" ]; then
34 | mkdir -p "${TARGET_DIR}"
35 | fi
36 | cp "${SOURCE_FILE}" "${TARGET_FILE}"
37 |
38 | # Rename the GDM3 monitors configuration
39 | if [[ "${TARGET_FILE}" == *"monitors.xml"* ]]; then
40 | mv -v "${TARGET_FILE}" "${TARGET_DIR}/monitors.xml"
41 | fi
42 | fi
43 | }
44 |
45 | function enable_umpc_config() {
46 | # NOTE! Do not inject this configuration anymore. The defaults are sane.
47 | # Enable Intel SNA, DRI1/3 and TearFree.
48 | # inject_data "${INTEL_CONF}"
49 |
50 | # Rotate the monitor.
51 | inject_data "${MONITOR_CONF}"
52 | inject_data "${MONITORS_XML}"
53 |
54 | # Scroll while holding down the right track point button
55 | inject_data "${TRACKPOINT_CONF}"
56 |
57 | # Rotate the touchscreen.
58 | inject_data "${TOUCH_RULES}"
59 | # Reload udev rules
60 | udevadm control --reload-rules
61 | udevadm trigger
62 |
63 | # Configure kernel modules
64 | inject_data "${MODPROBE_CONF}"
65 |
66 | # Apply device specific gschema overrides
67 | inject_data "${GSCHEMA_OVERRIDE}"
68 |
69 | # Add device specific /etc/grub.d configuration
70 | inject_data "${GRUB_D_CONF}"
71 |
72 | # Device specific tweaks
73 | case ${UMPC} in
74 | gpd-pocket)
75 | # Add BRCM4356 firmware configuration
76 | inject_data "${BRCM4356_CONF}"
77 | # Reload the brcmfmac kernel module
78 | modprobe -r brcmfmac
79 | modprobe brcmfmac
80 |
81 | # Increase console font size
82 | sed -i 's/FONTSIZE="8x16"/FONTSIZE="16x32"/' "${CONSOLE_CONF}"
83 |
84 | # Display Scaler
85 | inject_data "/usr/bin/umpc-display-scaler"
86 | inject_data "/etc/xdg/autostart/umpc-display-scaler.desktop"
87 | inject_data "/usr/share/applications/umpc-display-scaler.desktop"
88 | ;;
89 | gpd-pocket2)
90 | # Increase console font size
91 | sed -i 's/FONTSIZE="8x16"/FONTSIZE="16x32"/' "${CONSOLE_CONF}"
92 |
93 | # Display Scaler
94 | inject_data "/usr/bin/umpc-display-scaler"
95 | inject_data "/etc/xdg/autostart/umpc-display-scaler.desktop"
96 | inject_data "/usr/share/applications/umpc-display-scaler.desktop"
97 | ;;
98 | gpd-pocket3)
99 | # Increase console font size
100 | sed -i 's/FONTSIZE="8x16"/FONTSIZE="16x32"/' "${CONSOLE_CONF}"
101 |
102 | # Add automatic screen rotation
103 | gcc -O2 "data/umpc-display-rotate.c" -o "/usr/bin/umpc-display-rotate" -lm
104 | inject_data "/etc/xdg/autostart/umpc-display-rotate.desktop"
105 | inject_data "${HWDB_CONF}"
106 | systemd-hwdb update
107 | udevadm trigger -v -p DEVNAME=/dev/iio:device0
108 | systemctl restart iio-sensor-proxy.service
109 |
110 | # Display Scaler
111 | inject_data "/usr/bin/umpc-display-scaler"
112 | inject_data "/etc/xdg/autostart/umpc-display-scaler.desktop"
113 | inject_data "/usr/share/applications/umpc-display-scaler.desktop"
114 | ;;
115 | gpd-p2-max)
116 | # Increase console font size
117 | sed -i 's/FONTSIZE="8x16"/FONTSIZE="16x32"/' "${CONSOLE_CONF}"
118 | ;;
119 | gpd-micropc)
120 | true;;
121 | gpd-win2)
122 | true;;
123 | gpd-win-max)
124 | # Add device specific EDID
125 | inject_data "${EDID}"
126 | ;;
127 | topjoy-falcon)
128 | # Increase console font size
129 | sed -i 's/FONTSIZE="8x16"/FONTSIZE="16x32"/' "${CONSOLE_CONF}"
130 |
131 | # Add automatic screen rotation
132 | gcc -O2 "data/umpc-display-rotate.c" -o "/usr/bin/umpc-display-rotate" -lm
133 | inject_data "/etc/xdg/autostart/umpc-display-rotate.desktop"
134 | inject_data "${HWDB_CONF}"
135 | systemd-hwdb update
136 | udevadm trigger -v -p DEVNAME=/dev/iio:device0
137 | systemctl restart iio-sensor-proxy.service
138 |
139 | # Display Scaler
140 | inject_data "/usr/bin/umpc-display-scaler"
141 | inject_data "/etc/xdg/autostart/umpc-display-scaler.desktop"
142 | inject_data "/usr/share/applications/umpc-display-scaler.desktop"
143 | ;;
144 | esac
145 |
146 | update-grub
147 |
148 | echo "UMPC hardware configuration is applied. Please reboot to complete the setup."
149 | }
150 |
151 | function disable_umpc_config() {
152 | # Remove the UMPC Pocket hardware configuration
153 | for CONFIG in ${MONITOR_CONF} ${MONITORS_XML} ${TOUCH_CONF} ${TRACKPOINT_CONF} ${GSCHEMA_OVERRIDE} ${EDID} ${BRCM4356_CONF}; do
154 | if [ -f "${CONFIG}" ]; then
155 | rm -fv "${CONFIG}"
156 | fi
157 | done
158 |
159 | # Remove the framebuffer rotation
160 | sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="fbcon=rotate:1 quiet/GRUB_CMDLINE_LINUX_DEFAULT="quiet/' "${GRUB_DEFAULT_CONF}"
161 | sed -i 's/GRUB_CMDLINE_LINUX="fbcon=rotate:1"/GRUB_CMDLINE_LINUX=""/' "${GRUB_DEFAULT_CONF}"
162 | sed -i '/GRUB_GFXMODE=1200x1920x32/d' "${GRUB_DEFAULT_CONF}"
163 | update-grub
164 |
165 | # Restore tty font size
166 | sed -i 's/FONTSIZE=16x32"/FONTSIZE="8x16"/' "${CONSOLE_CONF}"
167 | # Remove apps
168 | rm -fv /usr/bin/umpc-display-rotate
169 | rm -fv /etc/xdg/autostart/umpc-display-rotate.desktop
170 | rm -fv /usr/bin/umpc-display-scaler
171 | rm -fv /etc/xdg/autostart/umpc-display-scaler.desktop
172 | rm -fv /usr/share/applications/umpc-display-scaler.desktop
173 |
174 | echo "UMPC hardware configuration is removed. Please reboot to complete the setup."
175 | }
176 |
177 | function usage() {
178 | echo
179 | echo "Usage"
180 | echo " ${0} enable || disable"
181 | echo ""
182 | echo "You must supply one of the following modes of operation"
183 | echo " enable : apply the ${MODEL} hardware configuration"
184 | echo " disable : remove the ${MODEL} hardware configuration"
185 | echo " help : This help."
186 | echo
187 | exit 1
188 | }
189 |
190 | # Make sure we are not running on Wayland
191 | if [ "${XDG_SESSION_TYPE}" == "wayland" ]; then
192 | echo "ERROR! This script is only designed to configure Xorg (X11). Please choose an alternative desktop session that uses Xorg (X11)."
193 | exit 1
194 | fi
195 |
196 | # Make sure we are root.
197 | if [ "$(id -u)" -ne 0 ]; then
198 | echo "ERROR! You must be root to run $(basename $0)"
199 | exit 1
200 | fi
201 |
202 | # Display usage instructions if we've not been given an action. If an action
203 | # has been provided store it in lowercase.
204 | if [ -z "${1}" ]; then
205 | usage
206 | else
207 | MODE=$(echo "${1}" | tr '[:upper:]' '[:lower:]')
208 | fi
209 |
210 | if [ -z "${UMPC}" ]; then
211 | echo "ERROR! You must supply the name of the device you want to apply modifications for."
212 | usage
213 | fi
214 |
215 | case "${UMPC}" in
216 | gpd-pocket|gpd-pocket2|gpd-pocket3|gpd-micropc|gpd-p2-max|gpd-win2|gpd-win-max|topjoy-falcon) true;;
217 | *) echo "ERROR! Unknown device name given."
218 | usage;;
219 | esac
220 |
221 | case "${MODE}" in
222 | -d|--disable|disable)
223 | disable_umpc_config;;
224 | -e|--enable|enable)
225 | enable_umpc_config;;
226 | -h|--h|-help|--help|-?|help)
227 | usage;;
228 | *)
229 | echo "ERROR! \"${MODE}\" is not a supported parameter."
230 | usage;;
231 | esac
232 |
--------------------------------------------------------------------------------