2021年11月

经测试升级后的pocke-thome 无效
更改 ~/.config/awesome/rc.lua您只需按ctrl+↑或ctrl+ ↓,音量将分别增加或减少 10%
先备份sudo cp .config/awesome/rc.lua .config/awesome/rc.lua.bak
sudo nano .config/awesome/rc.lua

-- Standard awesome library
require("awful")
require("awful.autofocus")
require("awful.rules")
-- Theme handling library
require("beautiful")
-- Notification library
require("naughty")

local USE_DBG = false
dbg = function (msg)
    if USE_DBG then
        naughty.notify({ preset = naughty.config.presets.critical,
                         title = "DBG MSG:",
                         text = msg })
    end
end

dbgclient = function (event_name, c)
    dbg(event_name.." "..tostring(c.pid).." "..tostring(c.window).." "..(c.class or "_c").." "..(c.name or "_n"))
end

-- {{{ Error handling
-- Check if awesome encountered an error during startup and fell back to
-- another config (This code will only ever execute for the fallback config)
if awesome.startup_errors then
    if USE_DBG then
        naughty.notify({ preset = naughty.config.presets.critical,
                         title = "Oops, there were errors during startup!",
                         text = awesome.startup_errors })
    end
end

-- Handle runtime errors after startup
do
    local in_error = false
    awesome.add_signal("debug::error", function (err)
        if USE_DBG then
            -- Make sure we don't go into an endless error loop
            if in_error then return end
            in_error = true

            naughty.notify({ preset = naughty.config.presets.critical,
                             title = "Oops, an error happened!",
                             text = err })
            in_error = false
        end
    end)
end
-- }}}

-- {{{ client API
onboard = {}
home_screen = {}

focus_next_client = function ()
    if awful.client.next(1) == home_screen.client then
        awful.client.focus.byidx( 2 )
    else
        awful.client.focus.byidx( 1 )
    end

    if client.focus then
        client.focus:raise()
    end
end

focus_client_by_window_id = function (window_id)
    for _, c in ipairs(client.get()) do
        if c.window == window_id then
            client.focus = c
            if client.focus then
                client.focus:raise()
            end
        end
    end
end

launch_home_screen = function ()
    if home_screen.client then
        client:kill()
        home_screen = {}
    end
    awful.util.spawn_with_shell("pocket-home")
end

focus_home_screen = function ()
    if home_screen.client then
        client.focus = home_screen.client
        if client.focus then
            client.focus:raise()
        end
    else
        launch_home_screen()
    end
end

hide_mouse_cursor = function ()
    -- hide mouse pointer on root window
    awful.util.spawn_with_shell("xsetroot -cursor $HOME/.config/awesome/blank_ptr.xbm $HOME/.config/awesome/blank_ptr.xbm")
end
-- }}}

-- {{{ Variable definitions
-- Themes define colours, icons, and wallpapers
beautiful.init("/home/chip/.config/awesome/theme.lua")

-- This is used later as the default terminal and editor to run.
local terminal = "x-terminal-emulator"
local editor = os.getenv("EDITOR") or "editor"
local editor_cmd = terminal .. " -e " .. editor

-- Default modkey.
-- Usually, Mod4 is the key with a logo between Control and Alt.
-- If you do not like this or do not have such a key,
-- I suggest you to remap Mod4 to another key using xmodmap or other tools.
-- However, you can use another modifier like Mod1, but it may interact with others.
local modkey = "Mod1"

-- Table of layouts to cover with awful.layout.inc, order matters.
local layouts =
{
    -- awful.layout.suit.floating,
    -- awful.layout.suit.tile,
    -- awful.layout.suit.tile.left,
    -- awful.layout.suit.tile.bottom,
    -- awful.layout.suit.tile.top,
    -- awful.layout.suit.fair,
    -- awful.layout.suit.fair.horizontal,
    -- awful.layout.suit.spiral,
    -- awful.layout.suit.spiral.dwindle,
    -- awful.layout.suit.max,
    awful.layout.suit.max.fullscreen,
    -- awful.layout.suit.magnifier
}
-- }}}

-- {{{ Tags
-- Define a tag table which hold all screen tags.
local tags = {}
for s = 1, screen.count() do
    -- Each screen has its own tag table.
    tags[s] = awful.tag({ 1 }, s, layouts[1])
end
-- }}}

-- {{{ Mouse bindings
root.buttons(awful.util.table.join(
    awful.button({ }, 4, awful.tag.viewnext),
    awful.button({ }, 5, awful.tag.viewprev)
))
-- }}}

volume_up = function ()
    volume_ctl("up", 10);
end
volume_down = function ()
    volume_ctl("down", 10);
end

volume_ctl = function (direction, amount)
    local current_vol = awful.util.pread("amixer sget 'Power Amplifier' | awk -F '[][]' '/dB/ {print substr($2, 1, length($2) - 1)}'")
    current_vol = current_vol:gsub("[\r\n%z]", " ")
    local target_vol = current_vol
    if direction == "up" then
        target_vol = current_vol + amount
        if target_vol > 100 then
            target_vol = 100
        end
    else
        target_vol = current_vol - amount
        if target_vol < 0 then
            target_vol = 0
        end
    end
    awful.util.pread("amixer sset 'Power Amplifier' "..target_vol.."%")
    naughty.notify({
        text="Volume: "..target_vol.."%",
        timeout=1
    })    
end


-- {{{ Key bindings
local globalkeys = awful.util.table.join(
    awful.key({ }                  , "XF86PowerOff", focus_home_screen),
    awful.key({"Control",      }, "Up", volume_up),
    awful.key({"Control",      }, "Down", volume_down),
    awful.key({ modkey,           }, "Tab", focus_next_client),
    awful.key({ "Control",        }, "Tab", focus_next_client),
    awful.key({ modkey,           }, "Return", function () awful.util.spawn("dmenu_run", false) end)

)

local clientkeys = awful.util.table.join(
    awful.key({ "Control"         }, "q", 
        function (c)
            if c ~= home_screen.client then
                c:kill()
            end
        end)
)

-- Compute the maximum number of digit we need, limited to 9
local keynumber = 0
for s = 1, screen.count() do
    keynumber = math.min(9, math.max(#tags[s], keynumber));
end

local clientbuttons = awful.util.table.join(
    awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
    -- left click and mode allows you to move windows
    awful.button({ modkey }, 1, awful.mouse.client.move),
    -- right click when holding mod
    awful.button({ "Control" }, 1, function (c) awful.util.spawn("xdotool click 3", false) end))

-- Set global keys
root.keys(globalkeys)
-- }}}

-- {{{ Rules
awful.rules.rules = {
    -- All clients will match this rule.
    { rule = { },
      properties = { border_width = 0,
                     border_color = beautiful.border_normal,
                     focus = true,
                     keys = clientkeys,
                     buttons = clientbuttons } }
}
-- }}}

-- {{{ Signals
-- Signal function to execute when a new client appears.

client.add_signal("focus", function (c)
  hide_mouse_cursor()
end)

client.add_signal("unfocus", function (c)
  if c == onboard.client then
      awful.util.spawn("xdotool search --name ahoy windowactivate", false)
  end
end)

client.add_signal("manage", function (c, startup)
    -- match homescreen by pid
    if c.name == "pocket-home" then
        home_screen.client = c
    -- match onboarding by class
    elseif c.class == "ahoy" then
        onboard.client = c
        c.ontop = true
    end

    if not startup then
      -- Put windows in a smart way, only if they does not set an initial position.
      if not c.size_hints.user_position and not c.size_hints.program_position then
          awful.placement.no_overlap(c)
          awful.placement.no_offscreen(c)
      end
    end
end)

-- cleanup watched clients
-- FIXME: make sure to ignore if we don't have a client, 
-- apparently it's possible for unmanage to be called before manage
-- when certain applications first open.
client.add_signal("unmanage", function (c)
    -- match homescreen
    if c.name == "pocket-home" then
        home_screen = {}
    -- match onboarding
    elseif c.class == "ahoy" then
        onboard = {}
    end
end)
-- }}}

-- {{{ Startup applications
hide_mouse_cursor()

-- map the keyboard
awful.util.spawn_with_shell("/usr/sbin/pocketchip-load")

-- launch onboarding
awful.util.spawn_with_shell("onboard $HOME/.config/onboard /usr/share/pocketchip-onboard/")

-- launch home screen
launch_home_screen()
-- }}}

原文地址https://blog.omgmog.net/post/pocket-chip-global-volume-control/

The original one was running a relatively heavy shell script (/usr/sbin/battery.sh) outputting many battery-related parameters in order to grep only 2 (voltage and charging status) and put them into two files that were later used by other scripts and even the default home screen program.

sudo apt-get install libx11-dev libxtst-dev git gcc make
git clone https://github.com/aleh/pocketchip-batt.git
cd pocketchip-batt
sudo make install

If you want to undo the changes:
sudo make uninstall

pocket-home appears to be constantly consuming up to 1-4% of CPU, must be polling something fairly hard, would be great to patch it. I've personallly moved to JWM, see https://github.com/aleh config https://github.com/aleh/pocketchip-jwmrc .

IMG_20211128_104916.jpg

继续
两种连接网络的方式
第一种 sudo nmtui
第二种 sudo nmcli d wifi connect "wifi名" password "wifi密码"
连上网之后
先 sudo apt update
然后 sudo apt install apt-transport-https ca-certificates
然后改清华源
sudo nano /etc/apt/sources.list
用#全注释掉原来的
粘贴入下面的
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free

安装xfce4
sudo apt install xfce4

安装调整亮度的,顶部右键panel add item power……
sudo apt install xfce4-power-manager-plugins

安装网络管理面板
sudo apt install network-manager-gnome

安装openssh-server并启动
sudo apt install openssh-server
sudo systemctl start ssh.service
sudo nano /etc/ssh/sshd_config
PermitRootLogin yes
PasswordAuthentication yes
设置自启动
sudo systemctl enable ssh

安装浏览器
sudo apt install midori

安装轻量级终端sakura
sudo apt install sakura
配置文件.config/sakura/sakura.conf
卸载xterm
sudo apt remove xterm

安装截图软件
sudo apt install xfce4-screenshooter

截图_2021-11-27_06-00-42.png

我的系统 Ubuntu 20.04.3 LTS
下载文件
文件1 https://macromorgan.s3.amazonaws.com/ntc-chip-mainline/flash_tool.tar.bz2

文件2 https://macromorgan.s3.amazonaws.com/ntc-chip-mainline/rootchipbasicuniversal.ubi

sudo apt install libusb-1.0-0-dev libz-dev libfdt-dev
git clone https://github.com/linux-sunxi/sunxi-tools.git
cd sunxi-tools
make

解压文件1 将sunxi-tools make后的 /home/xuefei/flash_tool/sunxi-fel 拷贝到 解压后的文件1文件夹里
修改flash_toshiba.sh 为

#!/bin/bash

echo "Loading Temporary SPL"
./sunxi-fel spl sunxi-spl.bin
echo "Loading U-Boot"
./sunxi-fel write 0x4a000000 u-boot-dtb.bin
echo "Loading Permanent SPL"
./sunxi-fel write 0x43000000 spl-400000-4000-500.bin
echo "Loading Flash Script"
./sunxi-fel write 0x44300000 ubootflash.scr
echo "Uploading mini-rootfs"
./sunxi-fel write 0x44400000 rootmin.ubi
echo "Executing U-Boot"
./sunxi-fel exe 0x4a000000
echo "When Device finishes it will shut down automatically. Please take the"
echo "device out of FEL mode, insert USB with root image, and power it back"
echo "on to continue the flashing process."

拷贝文件2到一个FAT32格式的U盘备用
跳线连接GND和FEL,插上USB线
然后 sudo ./flash_toshiba.sh
等灯自动熄灭之后拔掉设备
拔掉跳线,插上U盘,插上USB线
安装串口工具
sudo apt install screen
screen /dev/ttyACM0 115200
root登陆 无密码
mount /dev/sda4 /mnt
我这显示的U盘是sda4
ubiformat /dev/mtd3 -f /mnt/rootchipbasicuniversal.ubi
等两个进度执行完就可以拔掉重新插上
刷好了,无桌面
依然可以串口登陆
screen /dev/ttyACM0 115200

QQ图片20211114092729.jpg