pocketchip折腾笔记

photo_2019-09-17 21.48.26.jpeg
1,更换软件源

更换 /etc/apt/sources.list为以下

deb http://cdn-fastly.deb.debian.org/debian/ jessie main contrib non-free
deb-src http://cdn-fastly.deb.debian.org/debian/ jessie main contrib non-free

deb http://security.debian.org/ jessie/updates main contrib non-free
deb-src http://security.debian.org/ jessie/updates main contrib non-free

deb http://archive.debian.org/debian jessie-backports main contrib non-free
deb-src http://archive.debian.org/debian jessie-backports main contrib non-free

deb http://chip.jfpossibilities.com/chip/debian/repo jessie main
deb http://chip.jfpossibilities.com/chip/debian/pocketchip jessie main

设置 /etc/apt/preferences (否则更新后pico-8可能无法启动)

Package: *
Pin: origin chip.jfpossibilities.com
Pin-Priority: 1050

Package: *
Pin: origin chip.jfpossibilities.com
Pin-Priority: 1050

新增文件 /etc/apt/apt.conf.d/99checkvalid

Acquire::Check-Valid-Until "false";

2,设置locales tzdata

sudo dpkg-reconfigure locales 
sudo dpkg-reconfigure tzdata

3,安装中文字体

apt-get install xfonts-wqy ttf-wqy-zenhei ttf-wqy-microhei fonts-arphic-uming fonts-powerline

4,替换桌面为awesomewm(更轻量)

  1. 先取消自动登陆,修改/etc/lightdm/lightdm.conf,注释掉以下两行
    #autologin-user=chip
    #autologin-user-timeout=0
  2. 替换awesomewm默认的配置文件
    cp /etc/xdg/awesome/rc.lua ~/.config/awesome/
    cp -rf /etc/xdg/awesome/debian ~/.config/awesome/
  3. rc.lua 里面新增一行, 里面主要是为了加载键盘映射,还有显示亮度,触摸屏设置
    awful.util.spawn_with_shell("/usr/sbin/pocketchip-load")
  4. sudo service lightdm restart, 重启桌面, 右上角点击, 选择awesome,登陆
  5. 把1 里面的注释取消, 以后进入的就是awesome桌面了, 其他的桌面配置就按普通的配置就行

5, 取消触摸屏, 触摸屏实在是鸡肋, 而且很多操作基本都可以快捷键完成了
创建文件 /usr/local/bin/soload

#!/bin/bash
killall pocketchip-load
sleep 7
DISPLAY=:0 xinput disable 1c25000.rtp
/usr/sbin/pocketchip-load

修改rc.lua添加的那行为

awful.util.spawn_with_shell("/usr/local/bin/soload")

6, 休眠代码,chip的休眠实际上是显示器亮度调为0,

DISPLAY=:0 xset dpms force off

7,休眠屏蔽触摸屏
如果没有全局屏蔽触摸屏, 可以修改 /usr/sbin/pocketchip-load

#!/bin/bash

export POCKETCHIP=true

function setPocketchip {
    DISPLAY=:0 XAUTHORITY=${HOME}/.Xauthority xmodmap ${HOME}/.Xmodmap 2> /dev/null

    STATUS="$?"
    if [ "$STATUS" != "0" ] ; then
        while [ "$STATUS" != "0" ] ; do
            DISPLAY=:0 XAUTHORITY=${HOME}/.Xauthority xmodmap ${HOME}/.Xmodmap 2> /dev/null
            STATUS="$?"
            sleep 1
        done
    fi
    brightness=$(cat /sys/class/backlight/backlight/brightness)

    while [ -f /sys/class/backlight/backlight/brightness ]; do
                currentBrightness=$(cat /sys/class/backlight/backlight/brightness)
                screen=$(XAUTHORITY=${HOME}/.Xauthority DISPLAY=:0 xset q 2> /dev/null | grep "is O")
                if [[ $screen = *"is Of"* ]]; then
                        if [[ $currentBrightness != "0" ]]; then
                currentBrightness = 0
                brightness=$(cat /sys/class/backlight/backlight/brightness)
                DISPLAY=:0 xinput disable 1c25000.rtp
                            echo 0 > /sys/class/backlight/backlight/brightness
                        fi
                        sleep 0.5
                else
                        if [[ $currentBrightness = "0" ]]; then
                                DISPLAY=:0 xinput enable 1c25000.rtp
                echo $brightness > /sys/class/backlight/backlight/brightness
                        fi
                        sleep 5
                fi
    done
}

setPocketchip &

exit 0

8, 可以升级 pocket-home, 不过我不喜欢所以没有

https://github.com/o-marshmallow/PocketCHIP-pocket-home

9, 一些资料

http://www.chip-community.org/index.php/Main_Page
https://www.reddit.com/r/ChipCommunity/
https://github.com/aleh/pocketchip-batt
https://zhuanlan.zhihu.com/p/33833790
https://medium.com/@0x1231/nextthingco-pocket-c-h-i-p-flashing-guide-3445492639e

10, 杂七杂八的记录下,可以 t.me/l0l0l0ll 交流

Last modification:September 22nd, 2019 at 06:58 am

Comment here is closed