systemctl disable anydesk.service
「systemctl list-unit-files」可列出系統服務。另外 LXQT 有另一套 autostart 在 /etc/xdg/autostart。
參考
systemctl disable anydesk.service
「systemctl list-unit-files」可列出系統服務。另外 LXQT 有另一套 autostart 在 /etc/xdg/autostart。
參考
unsigned long copy_from_user (void *to, const void *from, unsigned long count); unsigned long copy_to_user (void *to, const void *from, unsigned long count);
在 read()、write()、或 ioctl() 等,可能需要在 user-space 和 kernel-space 間搬移資料,本質是 memcpy(),回傳未完成的 byte 數。此外也 access_ok() 檢查 user-space 指標是否 valid。另外有 __get_user() 和 __put_user()。
User-space 資料
如果不需要 access_ok() 檢查,例如已經檢查過,__copy_to_user()、__copy_from_user()、__get_user() 和 __put_user() 版本。
driver accesses user space must be reentrant, must be able to execute concurrently with other driver functions, and, in particular, must be in a position where it can legally sleep.
參考
fixed-point 是一種小數表示方式,儲存固定位數小數。某個固定單位的部份,皆可視為小數。
閱讀時,有小數點分隔整數和小數。但在內部處理程式,並沒有實際的分隔,而由程式隱含定義位置。
低成本嵌入式處理器,沒有浮點運算單元,有些計算需要定點運算適當的 scaling 來達到可接受的動態範圍。定點運算可以比浮點運算更快、更高精確度,但寫程式需要更精確預測數值範圍,調整 scaling facotr,避免 overflow。
表示法
加法和減法:相同 scaling factor,結果 scaling factor 不變。overflow。
乘法:scaling factor 相乘。在二進位,通常使用 scaling factor that is a power of two,乘完後 scaling factor 可透過 shifting right 調整回來。Rounding 可在 shift 前加上 scaling factor 的一半。證明:round(x/y) = floor(x/y + 0.5) = floor((x + y/2)/y) = shift-of-n(x + 2^(n-1))。
// saturate to range of int16_t
int16_t sat16(int32_t x)
{
if (x > 0x7FFF) return 0x7FFF;
else if (x < -0x8000) return -0x8000;
else return (int16_t)x;
}
int16_t q_mul(int16_t a, int16_t b)
{
int16_t result;
int32_t temp;
temp = (int32_t)a * (int32_t)b; // result type is operand's type
// Rounding; mid values are rounded up
temp += 1 << (Q - 1);
// Correct by dividing by base and saturate result
result = sat16(temp >> Q);
return result;
}
除法 https://lirobo.blogspot.com/2021/08/rounding-integer-division.html
int16_t q_div(int16_t a, int16_t b)
{
int32_t temp = (int32_t)a << Q;
// Rounding: mid values are rounded up.
if (((temp >> 31) & 1) == ((b >> 15) & 1)) {
temp += b>>1; // round up
} else {
temp -= b>>1; // round down for negative value
}
return (int16_t)(temp / b);
}
參考
Rounding 是用較短的、簡單的、或 more explicit 的近似值表示數值,例如 $23.4476 用 $23.45, 表示、,the fraction 312/937 用 1/3 表示,或 √2 用 1.414 表示。
捨棄低位元時,增加尾數 0 或減少小數位數,決定是否進位。
round down:捨去,是指 round toward zero,但在 2’s complement 數值會是 round toward negative infinity,負值是有所不同。
round up:進位。
round toward zero:無條件捨去法。正數捨去低位元是變小,負數捨去低位元是捨去一些負值而變大,所以都是趨向 0。ROUNDDOWN() truncate()
round away from zero:無條件進位法。捨去低位元時一律進位,正數是變大,負數是變小,所以都是遠離 0。ROUNDUP()
round toward negative infinity:程式的無條件捨去法。一般程式數值用 2’s complement,正數捨去低位元是變小,負數捨去低位元也是變小。floor()
round half down
round half up
round half toward zero (五捨六入)
round half away from zero (四捨五入)
round half toward even (四捨六入五成雙)
round half toward odd
round half alternatively
round half randomly
stochastic round
參考
truncation:無條件捨去法
round (round-to-nearest)
Barrier 予你用一組鍵盤滑鼠透過網路控制幾若電腦,意思是排除電腦之間的壁壘。Barrier 欲 Synergy 1.9 分出來,今仔 Symless 已經佮 Synergy 商業化,袂合。
每台電腦隴需要安裝佮執行 barrier。有鍵盤和滑的那台是 server,揤「Configure server」為每一台 client 拉一個新螢幕到格子,「Screen name」設作電腦的名。佇 client 設定 Server IP (或 Bonjour Auto config) 了 Start。
功能
問題
參考
實數分著整數 (integer) 和小數 (subinteger, fractional) 兩部份,中央是小數點 (decimal point,在二進位是 binal point),小數是實數中比 ±1 小的部份。有時陣,有小數部份的實數嘛叫做小數,有可能是表示著分數的有限小數或循環小數、或是無理數的不循環又無限的小數。
DSP 指令假定 binal point convention 的位置如下表:
| Register Size | Format | Notation | Sign Bit | Extension Bit | Fractional Bit |
|---|---|---|---|---|---|
| 40-bit | Signed | 9.31 | 1 | 8 | 31 |
| Unsigned | 8.32 | 0 | 8 | 32 | |
| 32-bit | Signed | 1.31 | 1 | 0 | 31 |
| Unsigned | 0.32 | 0 | 0 | 32 | |
| 16-bit | Signed | 1.15 | 1 | 0 | 15 |
| Unsigned | 0.16 | 0 | 0 | 16 |
1.31 乘以 1.31 是 2.62,過程中需要右移 31 位、或左移一位後取前半段,以維持 1.31。但在一般 32-bit 處理器,只有整數乘法,且結果沒有 64 bits 或大於 32 bits 的空間,只能存後面 32 bits,變成相乘前兩者都要先右移 16-bit,變成 17.15 乘 17.15,結果是 34.30,實際只存後面的 2.30,再左移 1 位變成 1.31,精確度會差一點。
整數除法如何保留小數?被除數左移 16-bit、除數又移 16-bit?
int Q = a/b; // quotaent
int r = a - b * Q; // remainder
int f = 0;
int p = 0; // 十進位小數位數
while (r) {
r *= 10;
f *= 10;
f += r/b;
p++;
}
int Q = a/b; // quotaent
int r = a - b * Q; // remainder
int f = 0; // fraction
int p; // 二進位小數剩餘位數
for (p = 32; p > 0; p--) {
f <<= 1;
r <<= 1;
q = r/b;
f |= q;
r -= b * q;
}
Saturation:結果大於最大值存成最大值,小於最小值存成最小值。
Overflow:結果超出暫存器範圍,捨棄 MSBs
Truncation 或 Rounding:移除 lower-order bits 減少 precision。
參考
所有 SIP 訊息 都要有 Via,縮寫 v。一開始的 UAC 和後續途經的每個 proxy 都會疊加一個 Via 放傳送的位址,依序作為回應的路徑。 格式 sent-protocol sent-by [ ;branch= branch ][ ; 參數 ...] s...