-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
494 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,93 @@ | ||
# minibook-support | ||
Softwares for CHUWI MiniBook (8-inch UMPC) | ||
Softwares for CHUWI MiniBook (8-inch) / MiniBook X (10-inch) running Linux | ||
|
||
## Softwares | ||
- Enable the tablet mode of the MiniBook / MiniBook X automatically when the MiniBook is folded. | ||
- Calibrate the trackpointer of the MiniBook (8-inch). | ||
|
||
- [x] trackpointerd | ||
- [x] keyboardd | ||
- [x] tabletmoded | ||
## Requirements | ||
|
||
### trackpointerd | ||
- CHUWI MiniBook / MiniBook X | ||
- Linux 6.9 or later | ||
- Needed for MiniBook X | ||
|
||
Trackpointerd is a daemon that manages the trackpointer of the MiniBook. | ||
### Dependencies | ||
|
||
- Calibrate the trackpointer | ||
- Switch enable/disable the trackpointer | ||
- base-devel | ||
- for Arch Linux | ||
- build-essential | ||
- for Debian-based Linux | ||
|
||
### keyboardd | ||
For other Linux distributions, please install the equivalent packages. | ||
|
||
Keyboardd is a daemon that manages the keyboard of the MiniBook. | ||
### Tested on | ||
|
||
- Switch enable/disable the keyboard | ||
- MiniBook (8-inch) | ||
- Arch Linux | ||
- Linux 6.10.5-arch1-1 | ||
- MiniBook X (10-inch) | ||
- Ubuntu 24.04 | ||
- Linux 6.10.6 | ||
|
||
## Installation | ||
|
||
```bash | ||
git clone https://github.com/petitstrawberry/minibook-support.git | ||
cd minibook-support | ||
make | ||
sudo make install | ||
``` | ||
|
||
## Softwares | ||
|
||
- [x] tabletmoded | ||
- [x] moused | ||
- [x] keyboardd | ||
|
||
### tabletmoded | ||
|
||
Tabletmoded is a daemon that triggers the tablet mode of the MiniBook. | ||
tabletmoded is a daemon that triggers the tablet mode of the MiniBook. | ||
|
||
- Auto detect the tablet mode | ||
- Switch enable/disable the tablet mode | ||
- Trigger the tablet mode when the MiniBook is folded | ||
- Untrigger the tablet mode when the MiniBook is unfolded | ||
- Disable the keyboard using keyboardd when the tablet mode is triggered and enable the keyboard when the tablet mode is untriggered | ||
- Disable the trackpointer using trackpointerd when the tablet mode is triggered and enable the trackpointer when the tablet mode is untriggered | ||
- Disable the mouse using moused when the tablet mode is triggered and enable the mouse when the tablet mode is untriggered | ||
|
||
## Requirements | ||
### moused | ||
|
||
- CHUWI MiniBook (8-inch UMPC) | ||
- Linux | ||
moused is a daemon that manages the trackpointer / trackpad of the MiniBook. | ||
|
||
## Installation | ||
- Calibrate the trackpointer / trackpad | ||
- Switch enable/disable the trackpointer / trackpad | ||
|
||
```bash | ||
git clone https://github.com/petitstrawberry/minibook-support.git | ||
cd minibook-support | ||
make | ||
sudo make install | ||
``` | ||
### keyboardd | ||
|
||
keyboardd is a daemon that manages the keyboard of the MiniBook. | ||
|
||
- Switch enable/disable the keyboard | ||
|
||
## Mechanism | ||
|
||
mousedd / keyboardd create virtual devices that pass through input events received from the moused / keyboard. By enabling and disabling this pass-through functionality, you can stop and enable these devices. It is also possible to process the values if necessary (e.g. calibration of the track pointer with moused). | ||
|
||
tabletmoded calculates the open/close angle of the screen based on the values of the two accelerometers built into the main unit, and determines whether the PC is in tablet mode or not based on the angle. When it is determined that the PC is in tablet mode, it disables the mouse and keyboard devices using moused and keyboardd. Furthermore, it issues an event (SW_TABLET_MODE) to enable the tablet mode by the created virtual device, and notifies the whole system that the PC is in the tablet mode. Depending on the desktop environment, the behavior will change for tablets (e.g., GNOME will enable the on-screen keyboard). | ||
|
||
This mechanism can be abused by keyloggers, etc., but of course we do not do any such processing, and you can check the source code if necessary. | ||
|
||
|
||
## License | ||
|
||
MIT License | ||
|
||
Copyright (c) 2024 petitstrawberry | ||
|
||
Please see [LICENSE](LICENSE) for more information. | ||
|
||
## Credits | ||
|
||
Debugging and testing on MiniBook X. | ||
|
||
Thanks to: | ||
- [8796n](https://github.com/8796n) | ||
- [kat0h](https://github.com/kat0h) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#ifndef _DEVICE_H_ | ||
#define _DEVICE_H_ | ||
|
||
#include <stdio.h> | ||
|
||
void get_device_model(char *device_model, size_t size); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
// Emit the event | ||
void emit(int fd, int type, int code, int value); | ||
|
||
// Clone the enabled event types and codes of the device | ||
void clone_enabled_event_types_and_codes(int fd, int fd_clone); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include <stdio.h> | ||
|
||
void get_device_model(char *device_model, size_t size) { | ||
FILE *fp = fopen("/sys/devices/virtual/dmi/id/product_name", "r"); | ||
if (fp == NULL) { | ||
return; | ||
} | ||
fgets(device_model, size, fp); | ||
fclose(fp); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.