2024/5/10

memo : ssh-copy-id

mlinux 用ssh-copy-id,windows 的話,就把 .ssh/id_rsa.pub 裡面的資料加到 server 的 .ssh/authorized_keys 就可以。

C:\User\<user-name>\.ssh

2024/5/7

enable ims serice

ims 是 4G 網路提供Voice Call 的服務 (VoLTE)。
所以要在連接4G 基地站時,做Voice 的撥/接,就要啟動 ims 服務。

這個是quectel 的命令.

MBN 好像是profile之類的 config 檔。
會針對不同營運商調整,而一般,最普通,未調整的就是 ROW_Generic_3GPP.
所以這個可以連所有營運商(?)

列出目前所有mbn檔
at+qmbncfg="list"
+QMBNCFG: "List",0,1,1,"ROW_Generic_3GPP",0x0501081F,201901141
+QMBNCFG: "List",1,0,0,"VoLTE-ATT",0x0501033C,201810121
+QMBNCFG: "List",2,0,0,"hVoLTE-Verizon",0x05010140,201811131
+QMBNCFG: "List",3,0,0,"Commercial-Sprint",0x05010205,201904021
每個 list 內容是:
  • index
  • selected
  • activate
  • name
  • version
  • release date
上面的example 代表select ROW_Generic_3GPP,而且也是active.

要select 用: AT+QMBNCFG="Select","ROW_Generic_3GPP"

要deactivate 用: AT+QMBNCFG="Deactivate" 就可以

QMBNCFG 用來確認有沒有activated profile.

然後是 ims 服務.
at+qcfg="ims"
+QCFG: "ims",0,0

OK
第一個數字是configuration:
  • 0: 由 MBN file 決定
  • 1: 啟動ims
  • 2: 不啟動ims
第二個數字代表VoLTE狀態
  • 0: VoLTE is disabled
  • 1: VoLTE is enabled
設定 ims 可以用:
at+qcfg="ims",0
ok
設定完後,要重新啟動:
at+cfun=1,1
OK
之後狀態才會生效。

AT+COPS 與基地站相關的操作

列出所有的基地站
at+cops=?
+COPS: 
(1,"Chunghwa Telecom","Chunghwa","46692",7),
(2,"Chunghwa Telecom","Chunghwa","46692",2),
(1,"TWN APT","APT","46612",7),
(3,"TWN APT","APT","46605",7),
(3,"TW Mobile","TWM","46697",2),
(3,"T Star","T Star","46689",7),
(3,"TW Mobile","TWM","46697",7),
(3,"T Star","T Star","46689",2),
(1,"Far EasTone","FET","46601",2),
(3,"TWN APT","APT","46605",2),
(1,"Far EasTone","FET","46601",7),
,(0-4),(0-2)
回答的每一行的每一個item是:
(stat,long alphanumeric,short alphanumeric,numeric,AcT)
stat:
  • 0: 未知
  • 1: 可用
  • 2: 目前使用中
  • 3: 禁用
long/short aplhanumeric 就是 operator的名稱,全名和縮寫。
Act 就是基地站的技術
  • 0 GSM
  • 1 GSM Compact
  • 2 UTRAN
  • 3 GSM w/EGPRS
  • 4 UTRAN w/HSDPA
  • 5 UTRAN w/HSUPA
  • 6 UTRAN w/HSDPA and HSUPA
  • 7 E-UTRAN
所以上面的list 可以看出...目前用的是 Chunghwa, UTRAN (就是3G)

設定自動選擇基地站 at+cops=0:
at+cops=0
ok

CTZE: "+32",0,"2024/05/07,02:26:11"

+CTZE: "+32",0,"2024/05/07,02:42:37"
設玩好像重新開機,然後問目前的基地站是:
AT+COPS?
+COPS: 0,2,"46692",7

OK

手動選擇基地站要用at+cops=1:
at+cops=1,2,"46692",2
OK

+CTZE: "+32",0,"2024/05/07,02:54:36"
好像也會重開機?
1 代表 手動,後面的 2 是 format 用 numberic, 所以後面用 "46692" 也就是 Chunghwa Telecom 的 numberic 代表號,最後是基地站的技術 7 - E-UTRAN也就是 LTE.

2024/5/2

VoLTE and IMS

ref: 以前Voice 跟 Data走的路不一樣。
Voice 是 switch - 就是像以前接線生依樣,把兩端用專用的線接起來。
Data 是 IP - 就是切割成一小塊一小塊,在網路中送到對手上。
所以當 Voice時,Data就停止了。因為要切到專用線路。

後來,Voice也想改用Data那樣,切成一小塊,在網路中傳。
所以在Data 的服務中就規劃了 IMS (IP Multimedia Subsystem),負責傳這些小塊的語音資料。

這個服務就叫VoLTE,需要經過 IMS 傳送資料。

在電信系統中,IMS了傳送語音封包,還負責以前語音的一些功能,例如DTMF,SMS。
IMS 提供的服務:
  • VoLTE over IMS
  • SMS over IMS
  • Emergency call over IMS
  • DTMF over IMS
  • SRVCC over IMS (負責舊的交換機系統溝通)

2024/4/30

Docker : container access host network

就是用 "--add-host="host.docker.internal:host-gateway",docker 會再container 的dns中加入 host.docker.internal 到 host ip
測試可以用:
docker container run --rm \
  --add-host="host.docker.internal:host-gateway" \
  debian:stable-slim \
  bash -c "apt-get update && apt-get install -y iputils-ping && ping -c 3 host.docker.internal"

2024/4/26

text-generation-webui error , character 'None'

有時候開啟chat 頁面會沒反應,一開始的 hello 訊息也沒出來。
console 的 error 是:
ERROR    Could not find the character "None" inside characters/. No character has been loaded.
  ...
  ...
File "/home/charles-chang/text-generation-webui/modules/chat.py", line 673, in load_character
    raise ValueError
查source 是在 parameter tab 的 chat tab 的Character option 中,沒有選任何一個(Assistant, Example),所以是None
選了之後就好了。


download model

大多需要 lfs,所以 apt install git-lfs 之後,就可以用了。
需要license 的好像還是只能手動。

msys2. SDL2 Hello

ref: 安裝需要的 package:
pacman -S git mingw-w64-x86_64-toolchain mingw64/mingw-w64-x86_64-SDL2 mingw64/mingw-w64-x86_64-SDL2_mixer mingw64/mingw-w64-x86_64-SDL2_image mingw64/mingw-w64-x86_64-SDL2_ttf mingw64/mingw-w64-x86_64-SDL2_net mingw64/mingw-w64-x86_64-cmake make
測試:
$ sdl2-config --cflags --libs
-IC:/msys64/ucrt64/include/SDL2 -Dmain=SDL_main
-LC:/msys64/ucrt64/lib -lmingw32 -mwindows -lSDL2main -lSDL2
用上面ref 的 example:
#include &;t;stdio.h>
#include <SDL2/SDL.h>

const int WIDTH = 800, HEIGHT = 600;

int main(int argc, char *argv[]) {
  SDL_Window *window;
  SDL_Renderer *renderer;
  if(SDL_Init(SDL_INIT_EVERYTHING) < 0) {
    printf("SDL_Init failed: %s\n", SDL_GetError());
    return 1;
  }

  window = SDL_CreateWindow("Hello, World!",
                                        SDL_WINDOWPOS_UNDEFINED,
                                        SDL_WINDOWPOS_UNDEFINED,
                                        WIDTH, HEIGHT,
                                        SDL_WINDOW_ALLOW_HIGHDPI);
  if(window == NULL) {
    printf("Could not create window: %s\n", SDL_GetError());
    return 1;
  }
  
  renderer = SDL_CreateRenderer(window, -1, 0);
  SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);
  SDL_RenderClear(renderer);

  SDL_RenderPresent(renderer);
  
  SDL_Event event;
  while(1) {
    if(SDL_PollEvent(&event)) {
      if(event.type == SDL_QUIT) {
        break;
      }
    }
  }

  SDL_DestroyWindow(window);

  SDL_Quit();
  return 0;
}
build:
$ gcc -o testsdl testsdl.c `sdl2-config --cflags --libs`

msys2, pacmain -s 失敗: 簽章等級不明

Error:
來自 David Macek <david.macek.0@gmail.com> 的簽章信任等級不明
然後這一篇 有說明一個危險的方法,disable signature verification.
Disabling signature checking

Warning: Use with caution. Disabling package signing will allow pacman to install untrusted packages automatically.
If you are not concerned about package signing, you can disable PGP signature checking completely. 
Edit /etc/pacman.conf and uncomment the following line under [options]:

SigLevel = Never

You need to comment out any repository-specific SigLevel settings too because they override the global settings. 
This will result in no signature checking, which was the behavior before pacman 4. 
If you decide to do this, you do not need to set up a keyring with pacman-key. 
You can change this option later if you decide to enable package verification.

text-generation-webui run microsoft_Phi-3-mini-128k-instruct error : trust_remote_code=True

load 玩model出現錯誤,console 顯示
ValueError: Loading models/microsoft_Phi-3-mini-128k-instruct requires you to execute the configuration file in that repo on your local machine. 
Make sure you have read the code there to avoid malicious use, then set the option `trust_remote_code=True` to remove this error.
在model tab 有一個checkbox 剛好就是 trust_remote_code,上面的說明:
Set trust_remote_code=True while loading the tokenizer/model. To enable this option, start the web UI with the --trust-remote-code flag.
所以是在啟動的時候...
./start_linux.sh --listen --trust-remote-code
哪個checckout 就check 了,model load and run OK

2024/4/25

bin_decode support 的compress method:
typedef enum {
    LV_IMAGE_COMPRESS_NONE = 0,
    LV_IMAGE_COMPRESS_RLE,  /*LVGL custom RLE compression*/
    LV_IMAGE_COMPRESS_LZ4,
} lv_image_compress_t;
在 decompress_image( ) 中,參考這個欄位。
lv_bin_decoder_open( ),

2024/4/5

Rust is installed now. Great!

To get started you may need to restart your current shell.
This would reload your PATH environment variable to include
Cargo's bin directory ($HOME/.cargo/bin).

To configure your current shell, you need to source
the corresponding env file under $HOME/.cargo.

This is usually done by running one of the following (note the leading DOT):
. "$HOME/.cargo/env"            # For sh/bash/zsh/ash/dash/pdksh
source "$HOME/.cargo/env.fish"  # For fish

2024/3/26

lvgl label, font

找 font 的 code:
/home/charles-chang/lv_sim_vscode_sdl/lvgl/src/font/lv_font_fmt_txt.c

static uint32_t get_glyph_dsc_id(const lv_font_t * font, uint32_t letter)
好像是..
/home/charles-chang/lv_sim_vscode_sdl/lvgl/src/font/lv_font_fmt_txt.c

const uint8_t * lv_font_get_bitmap_fmt_txt(const lv_font_t * font, uint32_t unicode_letter)
設定歸設定,之後的,可以在 draw_ 設定斷點,看到 call 的時機 (後來的 timer callback, update_layout(cb))

2024/3/25

android studio for platform

就是能 support AOSP source code 的 Android Studio。
好像是 Android Studio + plugin,有這個 plugin 後,在 Android Studio 的 Welcom Page,除了一般的New Project 和 Open 之外,
還會多一個 "Import Asfp Project"

選 Import Asfp Project 就是 Import Aosp 裡面的 project (code)
所以要設定 AOSP source code 位置。還有build 時,lunch 的 target 是 ? (例如 pixel4 就是 aosp_flame-userdebug)
後面才是挑選aosp 中,要 import 的 module (folder)

2024/3/12

wayland. weston hello-world

wayland 是新的 X protocol (?)。
wayland 也是一樣,一個 server 負責顯示,一堆 client 藉由 wayland protocol 要求 server 畫圖。
wayland server 的實做就是 weston。

weston 也可以 run 在 X上(變成 interpreter ?),所以在 ubuntu 上,使用 X 的系統,也可以 run wayland client.
開啟console 啟動 weston 就可以。
~$ weston
Date: 2024-03-12 CST
[15:11:15.003] weston 9.0.0
               https://wayland.freedesktop.org
               Bug reports to: https://gitlab.freedesktop.org/wayland/weston/issues/
               Build: 9.0.0
[15:11:15.003] Command line: weston
[15:11:15.003] OS: Linux, 6.5.0-25-generic, #25~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Feb 20 16:09:15 UTC 2, x86_64
[15:11:15.003] Starting with no config file.
[15:11:15.003] Output repaint window is 7 ms maximum.
[15:11:15.003] Loading module '/usr/lib/x86_64-linux-gnu/libweston-9/x11-backend.so'
[15:11:15.009] Loading module '/usr/lib/x86_64-linux-gnu/libweston-9/gl-renderer.so'
[15:11:15.019] EGL client extensions: EGL_EXT_platform_base EGL_EXT_device_base
               EGL_EXT_device_enumeration EGL_EXT_device_query
               EGL_KHR_client_get_all_proc_addresses EGL_EXT_client_extensions
               EGL_KHR_debug EGL_KHR_platform_x11 EGL_EXT_platform_x11
               EGL_EXT_platform_device EGL_KHR_platform_wayland
               EGL_EXT_platform_wayland EGL_EXT_platform_xcb
               EGL_MESA_platform_gbm EGL_KHR_platform_gbm
               EGL_MESA_platform_surfaceless
[15:11:15.026] EGL version: 1.5
[15:11:15.026] EGL vendor: NVIDIA
[15:11:15.026] EGL client APIs: OpenGL_ES OpenGL
...
然後看到一個小window 跑起來,裡面有小游標。

然後clone 這個 client example: hello-wayland make 就可以。
然後 run ./hello-wayland
就可以看到一個圖片show 在剛剛的 weston windows 上。



另外一個簡單測試 wayland server connection 的 client code:
#include <stdio.h>
#include <wayland-client.h>

int
main(int argc, char *argv[])
{
    struct wl_display *display = wl_display_connect(NULL);
    if (!display) {
        fprintf(stderr, "Failed to connect to Wayland display.\n");
        return 1;
    }
    fprintf(stderr, "Connection established!\n");

    wl_display_disconnect(display);
    return 0;
}
compile 的時候要 link wayland-client.so
gcc -o waylandclient waylandclient.c -lwayland-client
另外一個簡單的,紙提供 wayland sock connect 的 server (chatgpt 寫的):
#include <stdio.h>
#include <wayland-server.h>

int
main(int argc, char *argv[])
{
    struct wl_display *display = wl_display_create();
    if (!display) {
        fprintf(stderr, "Unable to create Wayland display.\n");
        return 1;
    }

    const char *socket = wl_display_add_socket_auto(display);
    if (!socket) {
        fprintf(stderr, "Unable to add socket to Wayland display.\n");
        return 1;
    }

    fprintf(stderr, "Running Wayland display on %s\n", socket);
    wl_display_run(display);

    wl_display_destroy(display);
    return 0;
}
一樣,compile 的時候要link wayland-server (-lwayland-server)

2024/3/4

build aosp android 12 for pixel4

repo version 顯示 repo launcher version 要是 2.15 以上。
"codenanme-tages-and-buildnumber" 去看,pixel4最後一個版本tag name 是 android-12.1.0_r11

所以
repo init -u https://android.googlesource.com/platform/manifest -b android-12.1.0_r11
repo sync -c -j8
官方說 "-c" 就可以只fetch current version (所以 repo init 不用加 --depth=1 ?)

download 玩aosp 後,要 download hardware 相關的 none-open binary.
要依照build id 來download,剛剛的android-12.1.0_r11 的 build id 是 SQ3A.220705.003.A1
有 google 跟 qualcomm 兩個 tgz 檔。

說明解開後是自解壓縮script,說在 aosp 的 root folder 執行,accept license後,就會放在正確位置 (vendor)。

開始build:
source build/envsetup.sh
接下來的lunch 要選pixel4,依照說明去 flash device 查,是 flame,所以:
lunch aosp_flame-userdebug
然後就可以用 "m" 來build,不用加任何option,他會看cpu核心數開啟對應process。
-- 用 i9 13 代,限制溫度70,64G ram, 普通hd, 需要90分鐘。



build kernel
現在AOSP 的kernel是 prebuilt kernel,所以要build 的話,要另外clone 下來。
kernel build法以 Android 12 為分界。
12 (含)以前,用build.sh
另外,pixel6以上,android 13(含)以上,支援 GKI (generalize kernel image),所以可以只update kernel vender part,所以只build 出 kernel 就可以。
古老的還是要build 好 kernel 後,到 aosp 再build 一次,把 kernel 包進去。

現在做 pixel4, android12 的作法:build.sh

用 repo clone source,先到kernel branch 去看android12 for pixel 4 的 branch name 是什嗎。
猜大概是 common-android12-5.10 吧?
repo init -u https://android.googlesource.com/kernel/manifest -b common-android12-5.10
repo sync -j8

燒錄

要先 unlock bootloader
pixel 4 要先到 Setting 中的 developement option 去開啟 allow unlock bootloader,
然後關機,按著volume down + power 開機進入bootloader mode.
用 fastboot flashing unlock 來unlock
其實在pixel 4 的 bootloader 畫面也有 unlock 選項,選後按下 power,他會自己 reboot,之後就是 unlock mode 了。

開始燒錄。
一樣在 bootloader mode,所以先進入 bootlaoder:
adb reboot bootloader
fastboot 要看環境變數 ANDROID_PRODUCT_OUT 來找 img 檔。
所以要先設定這個變數到剛剛 build 好的 aosp src /out/target/product/flame
之後就可以下
$ fastboot flashall -w
--------------------------------------------
Bootloader Version...: c2f2-0.4-7617419
Baseband Version.....: g8150-00111-210817-B-7650554
Serial Number........: 99211FFAXXXXXX
--------------------------------------------
Checking 'product'                                 OKAY [  0.070s]
Setting current slot to 'b'                        OKAY [  0.157s]
Sending 'boot_b' (65536 KB)                        OKAY [  1.850s]
Writing 'boot_b'                                   OKAY [  0.299s]
Sending 'dtbo_b' (8192 KB)                         OKAY [  0.340s]
Writing 'dtbo_b'                                   OKAY [  0.094s]
Sending 'vbmeta_b' (4 KB)                          OKAY [  0.140s]
Writing 'vbmeta_b'                                 OKAY [  0.078s]
Sending 'vbmeta_system_b' (4 KB)                   OKAY [  0.140s]
Writing 'vbmeta_system_b'                          OKAY [  0.078s]
Rebooting into fastboot                            OKAY [  0.070s]
< waiting for any device >
Sending 'super' (4 KB)                             OKAY [  0.018s]
Updating super partition                           OKAY [  0.025s]
Resizing 'product_b'                               OKAY [  0.003s]
Resizing 'system_b'                                OKAY [  0.003s]
Resizing 'system_ext_b'                            OKAY [  0.003s]
Resizing 'system_a'                                OKAY [  0.005s]
Resizing 'vendor_b'                                OKAY [  0.005s]
Resizing 'vendor_a'                                OKAY [  0.003s]
Resizing 'product_b'                               OKAY [  0.003s]
Sending sparse 'product_b' 1/2 (262140 KB)         OKAY [  6.835s]
Writing 'product_b'                                OKAY [  1.816s]
Sending sparse 'product_b' 2/2 (10064 KB)          OKAY [  0.274s]
Writing 'product_b'                                OKAY [  0.089s]
Resizing 'system_b'                                OKAY [  0.004s]
Sending sparse 'system_b' 1/4 (262140 KB)          OKAY [  7.071s]
Writing 'system_b'                                 OKAY [  1.884s]
Sending sparse 'system_b' 2/4 (262140 KB)          OKAY [  7.484s]
Writing 'system_b'                                 OKAY [  0.896s]
Sending sparse 'system_b' 3/4 (262140 KB)          OKAY [  6.993s]
Writing 'system_b'                                 OKAY [  0.873s]
Sending sparse 'system_b' 4/4 (34396 KB)           OKAY [  0.924s]
Writing 'system_b'                                 OKAY [  0.176s]
Resizing 'system_ext_b'                            OKAY [  0.004s]
Sending 'system_ext_b' (136184 KB)                 OKAY [  3.665s]
Writing 'system_ext_b'                             OKAY [  1.531s]
Resizing 'system_a'                                OKAY [  0.003s]
Sending 'system_a' (23492 KB)                      OKAY [  0.728s]
Writing 'system_a'                                 OKAY [  0.151s]
Resizing 'vendor_b'                                OKAY [  0.004s]
Sending sparse 'vendor_b' 1/4 (262140 KB)          OKAY [  7.022s]
Writing 'vendor_b'                                 OKAY [  1.893s]
Sending sparse 'vendor_b' 2/4 (262140 KB)          OKAY [  6.996s]
Writing 'vendor_b'                                 OKAY [  0.898s]
Sending sparse 'vendor_b' 3/4 (262140 KB)          OKAY [  7.075s]
Writing 'vendor_b'                                 OKAY [  0.902s]
Sending sparse 'vendor_b' 4/4 (42360 KB)           OKAY [  1.120s]
Writing 'vendor_b'                                 OKAY [  0.212s]
Erasing 'userdata'                                 OKAY [ 12.301s]
Erase successful, but not automatically formatting.
File system type raw not supported.
Erasing 'metadata'                                 OKAY [  0.008s]
Erase successful, but not automatically formatting.
File system type raw not supported.
Rebooting                                          OKAY [  0.000s]
Finished. Total time: 105.627s
可以看到燒錄過程中,燒完 dtb 和 system 後會自己 reboot,不要動他。
reboot 完會自己繼續download,最後 reboot,進入android.


memo 一下 pixel4 的最後版本 android-13.0.0_r31
一樣,下載 propriety binary 後 build OK, 但是燒錄後無法開機,停在 google logo 畫面。

另外,build 好的 aosp folder copy 到另一台機器上 會 build fail。
因為 out/host/linux-x86/b8in 下,有一些 python script 是絕對路徑的 link。



結果要燒回 factory ota image 時,用 adb sideload 出現 signiture verified error。
最後用 android flash tool 網頁版,才燒錄成功。

2024/2/26

msys2 pacman -S failed, key not verified

原來用得好好的,某一次後要安裝 package 就 fail,而且一直發生 db lock,
猜想可能是做過 upgrade : pacman -Syuu 的關係。
所以去找 release 的各個版本來試。
發現在 20231026 之後(包含),用 -S 安裝package 就發生 key 的問題了。
所以所有的版本要是做過 -Syuu 更新到最新版本,當然就會出問題。
-- 是過最新 daily build 版本也依樣。

所以只能拿 20230718 的版本來用,並且記得絕對不能 升級。

2024/2/22

repo: no module named 'formatter'

ref: 因為repo 使用的 python 在 python 3.10 之後,已經把 formatter 這個 module 移除了。
所以 google 建議修改成:
diff --git a/subcmds/help.py b/subcmds/help.py
index 1e16019..9c4756b 100644
--- a/subcmds/help.py
+++ b/subcmds/help.py
@@ -17,7 +17,7 @@
 from __future__ import print_function
 import re
 import sys
-from formatter import AbstractFormatter, DumbWriter
+import textwrap

 from subcmds import all_commands
 from color import Coloring
@@ -88,7 +88,7 @@ Displays detailed usage information about a command.
         Coloring.__init__(self, gc, 'help')
         self.heading = self.printer('heading', attr='bold')

-        self.wrap = AbstractFormatter(DumbWriter())
+        self._first = True

       def _PrintSection(self, heading, bodyAttr):
         try:
@@ -123,9 +123,12 @@ Displays detailed usage information about a command.
             self.nl()
             continue

-          self.wrap.add_flowing_data(para)
-          self.wrap.end_paragraph(1)
-        self.wrap.end_paragraph(0)
+        lines = textwrap.warp(para.replace(' ',' '), width=80, break_long_word=False, break_on_hyphens=False)
+
+        for line in lines:
+            self.write('%s',line)
+            self.nl()
+        self.nl()

     out = _Out(self.manifest.globalConfig)
     out._PrintSection('Summary', 'helpSummary')



其實可以去 .repo/repo 下面,加入 git-repo 做remote source,然後 checkout 一個新版也可以
git remote add gitrepo https://github.com/GerritCodeReview/git-repo
git fetch gitrepo
git checkout v2.29
.. 因為這個 repo mirror 最小的 tag 好像只有 v2.29,沒有更早的。

2024/2/21

Windows Terminal

ref: Windows 提供一個新的 terminal 程式,或者說是 front-end,背後可以是 PowerShell, Cmd, 或是自己install 的 msys。
以 msys2 的 shell 為例,自己增加一個 profile。

選 Setting,最下面的 "開啟 json 檔"
json 檔中的 "profiles" 就是一堆 shell 的command.

2024/2/16

Android Platform API, packages in api level

有關 Android 各版本提供的 api,可以查詢: 網頁左邊的panel,有一個 API level 的下拉選單,可以選 Api level
依照你選的 level 變更,不支援的 package 會變成灰色。
另外在每一個 package 的說明頁都會有 "Added in API level " 的標示。

api level 對應 Android OS version,android 10 之後:
Platform Version    API level
     14             34
     13             33
     12             32
                    31
     11             30
     10             29

另外,這個: Android OS core topics,左邊panel 的每個 item 都有列出每個feature 在 哪個 Android 版本開始實作。
太多了,每個都有細項可以看。


大概列一下每個版本新增的package api.

Android 14(level 34):
  • adservice : 不清楚,好想是open advertising id 供 ap 使用
  • documentid :
  • sdk sandbox : application sandbox 的 user api


有關 application 的 security, isolation,goole 有一篇說明從 android 5 到 android 10 的改進 -- app-sandbox:
  • In Android 5.0, SELinux provided mandatory access control (MAC) separation between the system and apps. However, all third-party apps ran within the same SELinux context so inter-app isolation was primarily enforced by UID DAC.
  • In Android 6.0, the SELinux sandbox was extended to isolate apps across the per-physical-user boundary. In addition, Android also set safer defaults for application data: For apps with targetSdkVersion >= 24, default DAC permissions on an app's home dir changed from 751 to 700. This provided safer default for private app data (although apps may override these defaults).
  • In Android 8.0, all apps were set to run with a seccomp-bpf filter that limited the syscalls that apps were allowed to use, thus strengthening the app/kernel boundary.
  • In Android 9 all non-privileged apps with targetSdkVersion >= 28 must run in individual SELinux sandboxes, providing MAC on a per-app basis. This protection improves app separation, prevents overriding safe defaults, and (most significantly) prevents apps from making their data world accessible.
  • In Android 10 apps have a limited raw view of the filesystem, with no direct access to paths like /sdcard/DCIM. However, apps retain full raw access to their package-specific paths, as returned by any applicable methods, such as Context.getExternalFilesDir().

其他的新功能還有 apk cached (freezer): cached-apps-freezer,加速 app 啟動時間。

大的功能是硬體的檢查: Android Health,一樣在每個android 版本有不同的實作。
一開始的brief:

Android 9 includes android.hardware.health HAL 2.0, a major version upgrade from health@1.0 HAL. This new HAL has the following advantages:
  • Cleaner separation between framework and vendor code.
  • Deprecates the unnecessary healthd daemon.
  • Greater degrees of freedom for vendor customization in health information reports.
  • More device health information than just battery.
Android 11 includes android.hardware.health HAL 2.1, a minor version upgrade from health@2.0 HAL. This new HAL has the following advantages:
  • Easier to implement
  • Better conformance with existing 2.0 HAL APIs
  • Better Treble separation in off-mode charging code
  • Better support for the framework to indicate the battery health of the device
Android 13 includes android.hardware.health AIDL HAL, a conversion from health@2.1 HAL. This new HAL has the following advantages:
  • Remove unused charger-related APIs
  • Remove unused StorageAttribute and related fields
  • Support dock charging.


Android 12 後:
新增 App Hibernation 功能。一段時間沒用的 app,會自動 release 他用的 memory 和 cache,把她放回 storage。
新增一個 memory monitor 的機制: MM Event -Historical Memory Statics

Android 14 新增一個 Power Mode : GAME.

test build android 14 for raspberry pi 4

因為要試試看 Android 12, 13, 14 的差異,所以用 raspberry pi 來測試。
順便紀錄一下很久沒做android (上次到 android 9) 之後,覺得是新的東西。
先照: 果然 prequreirement package 有新的:
sudo apt-get install bc coreutils dosfstools e2fsprogs fdisk kpartx mtools ninja-build pkg-config python3-pip
sudo pip3 install meson mako jinja2 ply pyyaml dataclasses
以 ubunutu 22.04,已經 build 過 android12 的系統。
結果缺 mtools (mcopy command). 和 pip install 的 meson, mako, ply.
結果用 pip3 install 還是 build fail,最後是用 apt (deb) 的 package 才 build OK

bionic/apex

結果是一種file format.從Android 10 就有了。
這種file 是用來更新用(?)
以往的 apk 都是用在 application 更新,所以都是由 package manager 負責。
但是如果是系統 component (例如native service),不是由 vm run 的程式,就沒版辦法了。
這個 apex 系統就是為了這個目的。
apex 檔案裡面主要是一個 ext4 的 img file,裡面包含需要的 program. so 和一些config file。
android 另外新增一個 apexd 服務,boot 時會檢查 /apex/ 目錄下有沒有 *.apex 檔案。
有的話就 把img loop mount,然後叫起裡面的服務。

另外,他也支援更新。因為 /apex 目錄是 ro,所以安裝都放在其他位置(/data ?)。
apexd 會去見查 /data 下有沒有 /apex/ 內檔案的對應新版本,有就用,沒有就用 /apex/ 下的。

結果在 android 14 上,幾乎所有東西都 apex 化了。
framework 裡的 service,甚至一些 apk 也都包裝成 apex.
out 目錄中,有一個 apex 目錄。裡面很多 componments folder.


raspberry-vanilla 開機失敗。
試試看: android-rpi

update: 開機成功。
失敗是因為使用 pi4, 2GB 版本,logcat 一直出現 oom, 最後 watchdog 出現 wait too long,然後 goodbye 重新啟動 dalvik ? activitymanager.
改用 4GB 版本直接開啟 OK


lunch aosp_rpi4_tv 的話,build fail:
ERROR: files are incompatible: android.hardware.camera.provider@2.5::ICameraProvider/legacy/0 is deprecated in compatibility matrix at FCM Version 8; it should not be served.
android.hardware.gatekeeper@1.0::IGatekeeper/default is deprecated in compatibility matrix at FCM Version 8; it should not be served.
android.hardware.graphics.allocator@4.0::IAllocator/default is deprecated in compatibility matrix at FCM Version 8; it should not be served.
android.hardware.graphics.composer@2.4::IComposer/default is deprecated in compatibility matrix at FCM Version 8; it should not be served.
android.hardware.keymaster@4.1::IKeymasterDevice/default is deprecated in compatibility matrix at FCM Version 8; it should not be served.
android.hardware.tv.cec@1.0::IHdmiCec/default is deprecated in compatibility matrix at FCM Version 8; it should not be served.
android.hardware.usb.gadget@1.2::IUsbGadget/default is deprecated in compatibility matrix at FCM Version 8; it should not be served.
android.hardware.camera.provider@2.5::ICameraProvider/legacy/0 is deprecated in compatibility matrix at FCM Version 8; it should not be served.
android.hardware.gatekeeper@1.0::IGatekeeper/default is deprecated in compatibility matrix at FCM Version 8; it should not be served.
android.hardware.graphics.allocator@4.0::IAllocator/default is deprecated in compatibility matrix at FCM Version 8; it should not be served.
android.hardware.graphics.composer@2.4::IComposer/default is deprecated in compatibility matrix at FCM Version 8; it should not be served.
android.hardware.keymaster@4.1::IKeymasterDevice/default is deprecated in compatibility matrix at FCM Version 8; it should not be served.
android.hardware.tv.cec@1.0::IHdmiCec/default is deprecated in compatibility matrix at FCM Version 8; it should not be served.
android.hardware.usb.gadget@1.2::IUsbGadget/default is deprecated in compatibility matrix at FCM Version 8; it should not be served.
android.hardware.camera.provider@2.5::ICameraProvider/legacy/0 is deprecated in compatibility matrix at FCM Version 8; it should not be served.
android.hardware.gatekeeper@1.0::IGatekeeper/default is deprecated in compatibility matrix at FCM Version 8; it should not be served.
android.hardware.graphics.composer@2.4::IComposer/default is deprecated in compatibility matrix at FCM Version 8; it should not be served.
android.hardware.keymaster@4.1::IKeymasterDevice/default is deprecated in compatibility matrix at FCM Version 8; it should not be served.
android.hardware.tv.cec@1.0::IHdmiCec/default is deprecated in compatibility matrix at FCM Version 8; it should not be served.
android.hardware.usb.gadget@1.2::IUsbGadget/default is deprecated in compatibility matrix at FCM Version 8; it should not be served.
android.hardware.camera.provider@2.5::ICameraProvider/legacy/0 is deprecated in compatibility matrix at FCM Version 8; it should not be served.
android.hardware.gatekeeper@1.0::IGatekeeper/default is deprecated in compatibility matrix at FCM Version 8; it should not be served.
android.hardware.graphics.allocator@4.0::IAllocator/default is deprecated in compatibility matrix at FCM Version 8; it should not be served.
android.hardware.graphics.composer@2.4::IComposer/default is deprecated in compatibility matrix at FCM Version 8; it should not be served.
android.hardware.keymaster@4.1::IKeymasterDevice/default is deprecated in compatibility matrix at FCM Version 8; it should not be served.
android.hardware.tv.cec@1.0::IHdmiCec/default is deprecated in compatibility matrix at FCM Version 8; it should not be served.
android.hardware.usb.gadget@1.2::IUsbGadget/default is deprecated in compatibility matrix at FCM Version 8; it should not be served.
The following instances are in the device manifest but not specified in framework compatibility matrix:
    android.hardware.camera.provider@2.5::ICameraProvider/legacy/0
    android.hardware.gatekeeper@1.0::IGatekeeper/default
    android.hardware.graphics.allocator@4.0::IAllocator/default
    android.hardware.graphics.composer@2.4::IComposer/default
    android.hardware.keymaster@4.1::IKeymasterDevice/default
    android.hardware.tv.cec@1.0::IHdmiCec/default
    android.hardware.usb.gadget@1.2::IUsbGadget/default
    android.hardware.wifi.supplicant.ISupplicant/default (@1)
Suggested fix:
1. Update deprecated HALs to the latest version.
2. Check for any typos in device manifest or framework compatibility matrices with FCM version >= 8.
3. For new platform HALs, add them to any framework compatibility matrix with FCM version >= 8 where applicable.
4. For device-specific HALs, add to DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE or DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE.: Success
INCOMPATIBLE
16:15:08 ninja failed with: exit status 1                                                                                                                                                 
#### failed to build some targets (43:52 (mm:ss)) ####   
update: 錯了,上面的error 是因為用 "m" 來build 導致的。
如果 follow 原 po 的說明,用
make bootimage systemimage vendorimage -j$(nproc)
就沒有 build fail 了。


android14 的話,還需要 texlive-full ,領外 meson 也要 0.6以上,所以 ubuntu 20.04 的話,apt 的 meson 版本不夠 (0.52),要用 pip 的版本才夠。
另外,要用 python3,所以乾脆整個系統都用 python3 了: python-is-python3

2024/2/7

LVGL set font and filesystem

ref: 會遭遇兩個問題:
  • 如何讀入字型檔
  • 如何設定字型
讀入就跟 filesystem 有關。
filesystem 就跟 platform 有關,是用 windows, linux 還是 mcu,filesystem 的 api 不一樣。
lvgl 用 lv_conf.h 來設定用哪個 api:
/*File system interfaces for common APIs */

/*API for fopen, fread, etc*/
#define LV_USE_FS_STDIO 1
#if LV_USE_FS_STDIO
    #define LV_FS_STDIO_LETTER 'A'     /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
    #define LV_FS_STDIO_PATH ""         /*Set the working directory. File/directory paths will be appended to it.*/
    #define LV_FS_STDIO_CACHE_SIZE 0    /*>0 to cache this number of bytes in lv_fs_read()*/
#endif

/*API for open, read, etc*/
#define LV_USE_FS_POSIX 0
#if LV_USE_FS_POSIX
    #define LV_FS_POSIX_LETTER 'A'     /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
    #define LV_FS_POSIX_PATH ""         /*Set the working directory. File/directory paths will be appended to it.*/
    #define LV_FS_POSIX_CACHE_SIZE 0    /*>0 to cache this number of bytes in lv_fs_read()*/
#endif

/*API for CreateFile, ReadFile, etc*/
#define LV_USE_FS_WIN32 0
#if LV_USE_FS_WIN32
    #define LV_FS_WIN32_LETTER '\0'     /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
    #define LV_FS_WIN32_PATH ""         /*Set the working directory. File/directory paths will be appended to it.*/
    #define LV_FS_WIN32_CACHE_SIZE 0    /*>0 to cache this number of bytes in lv_fs_read()*/
#endif
那個 LETTER 不是代表 windows 的 A 槽,B槽。而是用來代表 device.
像我用 ubuntu,試過用 "A:~/font.bin" 不行,一定要寫full path: "A:\home\charles\font.bin",然後用的是 FS_STDIO (會用 fopen())

load font 之後放進style,再把 style 設定到 object。
設定 font 跟 style 的 code:
     lv_font_t *myfont = lv_font_load("A:/home/charles/font.bin");
     static lv_style_t style;
     lv_style_init(&style);
     lv_style_set_text_font(&style,myfont);
要注意 stype 要是 static,因為之後系統會 periodically render 畫面,那時候會 access style 變數。如果是 local 變數,已經 free 調的話,就會出現 segment fault

下面用 example 的 label 為例子,設定 style:
    lv_obj_t * label1 = lv_label_create(lv_scr_act());
    lv_label_set_long_mode(label1, LV_LABEL_LONG_WRAP);     /*Break the long lines*/
    lv_label_set_recolor(label1, true);                      /*Enable re-coloring by commands in the text*/
    lv_label_set_text(label1, "TEST MY FONT");
    lv_obj_set_width(label1, 150);  /*Set smaller width to make the lines wrap*/
    lv_obj_set_style_text_align(label1, LV_TEXT_ALIGN_CENTER, 0);
    lv_obj_align(label1, LV_ALIGN_CENTER, 0, -40);
    
    lv_obj_add_style(label1,&style,0);

2024/1/31

HUB8735 - Ameba Pro2 - AMB82 MINI

不曉得是不是一樣的東西。

不過說除了用 Arduino IDE 之外,也可以用 Standard SDK.
然後就是說參考: 就 follow Project README: clone , untar tools, export PATH.
然後就可以開始 build example 了。
因為 build 最後的 tool 有分 linux 版的 *.linux 和 windows 版的 *.exe。
這個 repo 的 linux file attibute 沒有設定對,build 的時候會出現 Error。
所以先去把所有的 *.linux 加上 execution.
開始 build..
cd ambpro2_sdk/project/realtek_amebapro2_v0_example/GCC-RELEASE/build/
cmake .. -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake -DVIDEO_EXAMPLE=ON
cmake --build . --target flash_nn -j4
build 完,會是剛剛 --target 寫的 flash_nn.bin

燒錄是 tools/Pro2_PG_tool,把 zip 解開。把剛剛build 好的 flash_nn.bin copy 過來。
和用 Arduino IDE 一樣, HUB 8735 進入 download mode:
  • 短路 A5, 3V3 pin
  • 按一下 reset buuton
dmesg 看一下是 ttyUSB?

README 的說明 -b 2000000,會出現 ucf fail,看 ./uartfwburn.linux --help, -b 是 baudrate 的意思。
所以改成 9612000 後成功:
~/ambpro2_sdk/tools/Pro2_PG_tool _v1.3.0$ ./uartfwburn.linux -p /dev/ttyUSB0 -f flash_ntz.nn.bin -b 921600 -U
/dev/ttyUSB0 opened
ping ok
ucfg ok
Uart boot 
programing	[========================================] 100%        77824/       77824 bytes
programing done.
uboot ok
reset device
/dev/ttyUSB0 opened
ping ok
ucfg ok
download to offset 0x0
masked area [0x0, 0x0]
dowload 0, [0x0, 0xd9e000]
fw_len = 0xd9e000
programing	[========================================] 100%     14286848/    14286848 bytes
programing done.
done for download 0
download success
然後把 A5. 3V3 短路 pin 解開。reset
用 uart 115200 看到開機 log:
== Rtl8735b IoT Platform ==

[Normal mode]
BootFromNORFlash
[Start Boot ROM...]
=== Load PARTBL ===
=== Load Done ===
=== Load ISP_IQ ===
[fcs chk pass]
ISP_IQ @ 0x8401080, 0x2cf80, 0x0
mfcs_data version 0x00010001
fcs_data version 0x00010101
=== Process ISP_IQ ===
=== Load Done ===
=== Load BL ===
[Image Start Table @ 0x18200]
=== Load Done ===

== Boot Loader ==
Jul 12 2023:11:11:05
=== Load FCS Para ===
=== Load Done ===
[crc pass]
=== Load ISP_IQ Sensor ===
ISP_IQ @ 0x8401080, 0x2cf80
=== Process ISP_IQ ===
=== Load Done ===
=== Load FW1 ===
FW_ISP_IQ @ 0x8081080, 0x2ef80
=== Process FW_ISP_IQ ===
DRAM_TYPE is DDR2 128MB.
ddr_freq = 533
VOE flash @ 0x80b0080, 0x7ef80
FCS KM_status 0x00002081 err 0x0000200a
Wait KM fcs done 0 us
FCS TM_status 0x003f0000 
store fcs data for application 
RAM TM_STATUS 0x00bf0000 status 0x00000080
RAM TM_STATUS 0x00bf1208 err 0x00001208
read fcs_status 0x000000bf
                                                                                                                                               read fcs_status 0x000000bf
== Process VOE IMG ===
[Image Start Table @ 0x20106200]
RAM Load @ 0x812f100->0x20106200, 0x6a58
DDR Load @ 0x8136080->0x70100000, 0x19f574
=== FW Load Done ===

Boot Loader <==

== RAM Start ==
Build @ 15:20:47, Sep 13 2023

$8735b>interface 0 is initialized
interface 1 is initialized
cfg_size_lib = 29, cfg_size_user = 29

Initializing WIFI ...[Driver]: [HALMAC]
 11692M HALMAC_MAJOR_VER = 1
 HALMAC_PROTOTYPE_VER = 4
 HALMAC_MINOR_VER = 20
 HALMAC_PATCH_VER = 
[Driver]: The driver include MP
[Driver]: Ver = libwlan:2023.07.21.14.18_b9.5_a20c848742482c5f0ee2b39dd14c0c200435e46b
- download_firmware_88xx HALMAC_RET_SUCCESS
RFE type = 0
start_addr=(0x4000), end_addr=(0x8000), buffer_size=(0x4000), smp_number_max=(2048)

WIFI initialized
[FAST_CONNECT] Fast connect profile is empty, abort fast connection

init_thread(49), Available heap 0x6b847e0

use ATW0, ATW1, ATWC to make wifi connection
wait for wifi connection...

#
最後的 # 是按下 Enter 後出現的 prompt,因為 README 說要下命令 config wifi..
ATW0=<WiFi_SSID> : Set the WiFi AP to be connected
ATW1=<WiFi_Password> : Set the WiFi AP password
ATWC : Initiate the connection
下完之後,開始 scan , connect...
Interface 0 IP address : 172.24.1.117

init_thread(49), Available heap 0x6b82200
[video_voe_presetting] fps:30  w:1920  h:1080   

 voe heap size = 13455104
fwin(1),enc_en(0),IQ_OFFSET = 0x16520
 fwin(1),enc_en(0),SENSOR_OFFSET = 0x2e560
sensor id 1 iq_data 16520 sensor_data 2e560
hal_voe_ready 0x0 0xbf1208 
 read fcs_status 0x000000bf
[video_init] uvcd iq is null, use default.
[video_init] uvcd SNR is null, use default.
IQ:FW size (98342)
sensor:date 2023/7/18 version:RTL8735B_VOE_1.4.4.0
sensor:FW size (1812)
sensor timestamp: 2023/07/18
iq timestamp: 2023/05/15 14:48:54
ISP:1 ENC:1 H265:1 NN:1
hal_voe_ready 0x0 0xbf1208 
voe   :RTL8735B_VOE_1.4.4.0 
sensor:RTL8735B_VOE_1.4.4.0 
hal   :RTL8735B_VOE_1.4.4.0 
load time sensor:52us iq:2722us itcm:0us dtcm:0us ddr:0us ddr2:0us

RTSP[0] port: 554
fwin(1),enc_en(0),IQ_OFFSET = 0x16520
connect successful sta mode

 fwin(1),enc_en(0),SENSOR_OFFSET = 0x2e560
sensor id 1 iq_data 16520 sensor_data 2e560
hal_voe_ready 0x0 0x1718 
npu[7045d6e0] gck vip_drv_init, video memory heap base: 0x77000000, size: 0x01000000
NN IRQ default priority : 0, set to 9
npu[7045d6e0] HASHMAP 0x0x703fa994(process ID) INIT SUCCESS
npu[7045d6e0] HASHMAP 0x0x703fb6a0(memory wrap) INIT SUCCESS
npu[7045d6e0] HASHMAP 0x0x703fc2ec(network information) INIT SUCCESS
npu[7045d6e0] HASHMAP 0x0x703fcf10(segment information) INIT SUCCESS
VIPLite Drv version 10c00
set yolo confidence thresh to 0.500000
set yolo NMS thresh to 0.300000
Deploy YOLOv4t
...
開啟 vlc 連到 rtsp://172.24.1.117:554,就可以看到 yolov4 objection detection 的輸出。

2024/1/20

HUB 8735

ref: 下載 IDE (linux 用 zip。解開)

安裝 HUB 8735 的 board support package (?):
在 IDE 的 perference -- Settings -- Additional board manager URL 中,填入:
https://github.com/ideashatch/HUB-8735/raw/main/amebapro2_arduino/Arduino_package/ideasHatch.json
然後到 Tools -- Board -- Board Manager ,找 HUB 8735,會出現 ideaHatch Ameba Board,選一版 install (4.0.8-R).

完成後,Tools -- Board 的內容就會多一個 ideaHatch Ameba Boad 可以選。
選 HUB-8735


File -- Example -- AmebaMultimedia -- StreamRTSP -- VideoOnly
開啟 example : streaming server

修改 source code 中的 ssid[],pass[]到家裡的 wifi,
Sketch -- Verify/Compile
開始 make,
出現 Error:
misc/elf2bin.linux: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./misc/elf2bin.linux)
看一下自己系統的 libc 版本:
strings /lib/x86_64-linux-gnu/libc.so.6  | grep GLIBC
..
只有列到 GLIBC_2.30
所以是 ubuntu 版本不夠新(20.04)
ref: Error /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found
sources.list 加入
deb http://security.ubuntu.com/ubuntu jammy-security main 
然後 apt update, apt install lib
結果 lib 是很重要的 libary,所以一堆 service 要重開。

之後IDE重 Verify/Compile就 OK 了。

--- 這樣好像會 break distribution,update,upgrade之後,一堆function failed,

硬體接線。

hub 8735 使用 usb-uart 的 5V 就可以驅動了。
所以就順便用 usb-uart 的 5V, GND, TX, RD 接到 板子上。
usb-uart 插入nb,出現 ttyUSB0,
IDE 選 board, port : HUB 8735, ttyUSB0

讓 hub 8735 進入 download mode:

跟接 usb-uart 的四根 pin 的最旁邊的兩 pin : 3.3V, A5 ,短路後,按下正面的 led 旁邊的 button,就會 reboot into download mode.
在 IDE -- script -- upload,開始 build and upload.
IDE log 會出現:
Sketch uses 5054464 bytes (30%) of program storage space. Maximum is 16777216 bytes.
  Enter Flash Mode!
  Start Upload Flash
    Uploading...................upload success
  End Upload Flash
upload 完成,把剛剛的 A5, 3.3V 斷開。
開啟 uart terminal (picocom , 115200),按下正面 reset .. 可以看到開機 log..
    - RTSP -
rtsp://192.168.213.200:
[INFO] 554
開啟 VLC --- Media -- Open Network Stream
填入 rtsp://192.168.213.200:554
play 就可以看到畫面,開啟 VLC 的 codec information :
resolution : 1920x 1080, 30fps



另一種,不用 arduino,用一般mcu programming, gcc build 的方法是 sdk.
這個是 run yolov4 的 example:
20240130 update:

在 linux 的 arduino 安裝hub8735 的 board package 時,版本更新到 4.0.9 了,結果出現 Error,說 ameba_pro2_tools_linux-1.2.13 的 file size 錯,
去 release download gz 後看,果然 json 寫錯了。
後來發現 sha256sum 也錯,只好 fork 自己改,所以那個 json url 要改:
https://raw.githubusercontent.com/checko/HUB-8735/main/amebapro2_arduino/Arduino_package/ideasHatch.json
這樣安裝就 OK 了,所以也做了 pull request,之後應該就會改了吧。
-- size 和 checksum 都錯,有可能是 gz 放錯了,所以還是要等主站確定,ˋ這個只是暫時的方法。


Reatek AMB82 Mini

這個跟 HUB8735 很像,都是用 realtek RTL8735B,但是 GPIO pin 腳好像不一樣。
realtek 也有給他一個 arduino 的 sdk: 用法依樣,把 json 檔的 raw path 寫到 preference...

2024/1/19

Arduino Uno R3

Uno R3 有兩顆 MCU:
  • ATMEGA328P : 主 MCU
  • ATMEGA16U2 : 做 usb - uart 轉換

然後 有 R3 SMD 版,差異是 ATMEGA238P 這一棵由 DIP 改 SMD

另外有一種 CH340 版,就是用 CH340 這棵 usb-uart IC 換掉 ATMEGA16U2,可能有比較便宜吧,還有 CH340 的 baudrate 好像可以比較高。
相容性的話,因尾 Arduino IDE 只把 ATMEGA16U2 視為 usb-uart。並沒有 program 他,所以用起來應該一樣。

實際上也有project 把 ATMEGA16U2 改成 HID : keyboard,但是燒錄就要用 另一塊 arduno,hardware socket 和 dfu program.
如果沒有要動到 ATMEGA16U2,那麼選 便宜的 CH340 版本也行。

2024/1/8

gitlab 16.7 docker run

在名叫 i9rtx3090 的機器上啟動 gitlab-ce (現在的latest 應該是 16.7)
docker run -d --hostname i9rtx3090 --name gitlab -p 8080:80 gitlab/gitlab-ce
因為 gitlab 啟動很慢,所以看一下docker log:
docker logs gitlab
[execute] Running db:schema:load rake task 的時候會久一點。

16.7 版在 create issue 後,browse issue 會出現 hostname 沒有加上 port 的狀況。
如果Docker container 用 80,也就是 -p 80:80 的話就 OK
-- 另外,在 12.10 版沒有這個問題。

16.7 版docker 啟動後,root password 在 /etc/gitlab/initial_root_password 裡面。
所以用
docker exec -it gitlab /bin/bash
進去container 裡面看。
就可以用這個 password 登入 root 了。