Files
game-driver/todo.md

143 lines
3.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 技术点记录
## linux 下播放音频
```bash
sudo apt install libasound2-dev alsa-utils
```
## linux 下播放视频
```bash
sudo apt install ffmpeg
```
显示安装
```bash
sudo apt install libdirectfb-dev # 轻量级显示服务器
# 或
# sudo apt install xorg
```
### 当前用户加入播放音频与视频的组中
```bash
sudo usermod -aG audio,video $USER
```
### 关闭屏幕帧缓冲(关闭背光)
```bash
# 关闭帧缓冲设备
echo 1 | sudo tee /sys/class/graphics/fb0/blank
# 重新打开帧缓冲设备
echo 0 | sudo tee /sys/class/graphics/fb0/blank
# xorg 环境,关闭背光
xset dpms force off
# xorg 环境,重新打开背光
xset dpms force on
```
### 播放视频
```bash
ffplay -autoexit -fs -i video.mp4
```
## 编译 arm64 架构
```bash
CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -o game-driver-arm64 .
```
## J8引脚
```bash
J8:
3V3 (1) (2) 5V
GPIO2 (3) (4) 5V
GPIO3 (5) (6) GND
GPIO4 (7) (8) GPIO14
GND (9) (10) GPIO15
GPIO17 (11) (12) GPIO18
GPIO27 (13) (14) GND
GPIO22 (15) (16) GPIO23
3V3 (17) (18) GPIO24
GPIO10 (19) (20) GND
GPIO9 (21) (22) GPIO25
GPIO11 (23) (24) GPIO8
GND (25) (26) GPIO7
GPIO0 (27) (28) GPIO1
GPIO5 (29) (30) GND
GPIO6 (31) (32) GPIO12
GPIO13 (33) (34) GND
GPIO19 (35) (36) GPIO16
GPIO26 (37) (38) GPIO20
GND (39) (40) GPIO21
```
## 极简桌面环境并自动登录
### 安装 xorg i3
```bash
sudo apt install xorg i3-wm
```
### 自动启动 Xorg 和窗口管理器
编辑 `.bashrc`文件,在文件的末尾添加以下行:
```bash
if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ]; then
startx
fi
```
这会在你登录后,自动启动 Xorg 和窗口管理器。该脚本检查当前是否在 tty1 控制台(默认终端)上
### 自动登录
编辑 `/etc/systemd/system/getty.target.wants/getty@tty1.service` 文件,将 `ExecStart` 行修改为:
```bash
ExecStart=-/sbin/agetty --autologin <your_username> --noclear %I $TERM
```
其中:
- <your_username>:替换为你想自动登录的用户名。
### 禁用 i3bar 状态栏
编辑 `~/.config/i3/config`,将如下行注释掉:
```bash
# bar {
# status_command i3status
# }
```
### 配置 i3
安装 `unclutter`
```bash
sudo apt install unclutter
```
编辑 `~/.config/i3/config`,添加如下行:
```bash
exec --no-startup-id unclutter -root # 隐藏鼠标
exec --no-startup-id xset -dpms # 关闭屏幕自动关闭
exec --no-startup-id xset s off # 关闭屏幕保护
```
### 安装中文字体和 emoji 字体
```bash
sudo apt install fonts-noto-cjk fonts-noto-color-emoji
```
## 安装浏览器作为默认启动页面
### 安装浏览器
```bash
sudo add-apt-repository ppa:xtradeb/apps
sudo apt update
sudo apt install ungoogled-chromium
```
### 设置默认启动页面
编辑 `~/.config/i3/config`,添加如下行:
```bash
exec --no-startup-id ungoogled-chromium --kiosk --disable-extensions --disable-translate --app=<your_url>
```