2023-10-22 (Sun)

Boox Drop's API

I investigated HTTP APIs used by Boox Drop to manage files in Boox e-paper devices.

No guarantee!!

Directory Listing

curl -G http://BOOX_IP_ADDRESS:8085/api/storage \
 --data-urlencode 'args={"dir":"/storage/emulated/0/Books"}'

-G forces GET, not POST, even with --data-urlencode.

This returns a list in JSON, which looks like (tidied by jq):

{
      {
        "dir": false,
        "name": "Test1.pdf",
        "path": "/storage/emulated/0/Books/Test1.pdf",
        "size": 358469,
        "updatedAt": 1689988630000
      },
      ...
}

Directory Creation

curl http://BOOX_IP_ADDRESS:8085/api/storage/directory \
 -H 'Content-Type: application/json;charset=UTF-8' \
 --data-raw '{"parent":"/storage/emulated/0/Books","name":"FolderTest"}'

Upload to Boox

This uses multipart form post.

curl http://BOOX_IP_ADDRESS:8085/api/storage/upload \
 -F dir=/storage/emulated/0/Books/FolderTest \
 -F file=@/path-to/TESTFILE

Download from Boox

curl -G http://BOOX_IP_ADDRESS:8085/api/storage/file \
 --data-urlencode 'args=/storage/emulated/0/Books/FolderTest/TESTFILE'

Using this on a directory returns rubbish.

Deletion

curl -X DELETE -G http://BOOX_IP_ADDRESS:8085/api/storage/delete \
 --data-urlencode 'args=/storage/emulated/0/Books/FolderTest/TESTFILE'

This can also delete a folder, even when it contains files within!

curl -X DELETE -G http://BOOX_IP_ADDRESS:8085/api/storage/delete \
 --data-urlencode 'args=/storage/emulated/0/Books/FolderTest'

The Web interface uses api/storage/directory/delete, though. Apparently that allows deleting multiple files in one go.

USB デバイスの電源を切る

"Power management for USB" によると、/sys/bus/usb/devices/XXX/power/controlauto にしておくと idle 状態になって /sys/bus/usb/devices/XXX/power/autosuspend_delay_ms ミリ秒後に自動的にオフになり、要求があればまた起きるらしい。HDD のようなデバイスの場合 idle 状態がどう定義されるのか、マウントされていない状態のことか、それともアクセスがない状態のことか、未確認。

i7z

i7z という CPU 周波数をリアルタイムで表示するツールを知った。

13th Gen Intel Core i9-13900H の無負荷時でファンが停止してる時:

Socket [0] - [physical cores=14, logical cores=20, max online cores ever=14]
  TURBO ENABLED on 14 Cores, Hyper Threading ON
  Max Frequency without considering Turbo 3094.83 MHz (99.83 x [31])
  Max TURBO Multiplier (if Enabled) with 1/2/3/4/5/6 Cores is  54x/54x/51x/51x/49x/49x
  Real Current Frequency 887.60 MHz [99.83 x 8.89] (Max of below)
        Core [core-id]  :Actual Freq (Mult.)      C0%   Halt(C1)%  C3 %   C6 %  Temp      VCore
        Core 1 [0]:       638.14 (6.39x)           1    84.2       0    15.6    37      0.6820
        Core 2 [2]:       806.91 (8.08x)           1    92.8       0    7.07    36      0.6720
        Core 3 [4]:       885.43 (8.87x)         5.4    94.4       0    3.99    40      0.6725
        Core 4 [6]:       887.60 (8.89x)        5.05    85.2       0    13.3    35      0.6775
        Core 5 [8]:       828.24 (8.30x)        4.65    86.6       0    12.1    36      0.6775
        Core 6 [10]:      759.88 (7.61x)        3.35    94.8       0     4.4    35      0.6925
        Core 7 [12]:      731.32 (7.33x)           1    0.55       0    99.3    39      0.6775
        Core 8 [13]:      844.35 (8.46x)           1    0.238      0    99.7    39      0.6775
        Core 9 [14]:      830.58 (8.32x)           1    1.19       0    98.8    39      0.6775
        Core 10 [15]:     764.18 (7.65x)           1    0.341      0    99.6    39      0.6775
        Core 11 [16]:     801.95 (8.03x)           1    2.19       0    97.8    40      0.6765
        Core 12 [17]:     783.89 (7.85x)           1    0.625      0    99.4    40      0.6715
        Core 13 [18]:     819.86 (8.21x)           1    1.13       0    98.8    41      0.6715
        Core 14 [19]:     782.10 (7.83x)           1    1.73       0    98.2    41      0.6715

CPU 温度 (sensors による):

coretemp-isa-0000
Adapter: ISA adapter
Package id 0:  +44.0°C  (high = +100.0°C, crit = +100.0°C)
Core 0:        +38.0°C  (high = +100.0°C, crit = +100.0°C)
Core 4:        +37.0°C  (high = +100.0°C, crit = +100.0°C)
Core 8:        +41.0°C  (high = +100.0°C, crit = +100.0°C)
Core 12:       +36.0°C  (high = +100.0°C, crit = +100.0°C)
Core 16:       +37.0°C  (high = +100.0°C, crit = +100.0°C)
Core 20:       +35.0°C  (high = +100.0°C, crit = +100.0°C)
Core 24:       +40.0°C  (high = +100.0°C, crit = +100.0°C)
Core 25:       +40.0°C  (high = +100.0°C, crit = +100.0°C)
Core 26:       +40.0°C  (high = +100.0°C, crit = +100.0°C)
Core 27:       +40.0°C  (high = +100.0°C, crit = +100.0°C)
Core 28:       +41.0°C  (high = +100.0°C, crit = +100.0°C)
Core 29:       +41.0°C  (high = +100.0°C, crit = +100.0°C)
Core 30:       +41.0°C  (high = +100.0°C, crit = +100.0°C)
Core 31:       +41.0°C  (high = +100.0°C, crit = +100.0°C)

一方、10 年前のラップトップ(Intel Core i7-3537U) だと、こちらも無負荷時で(ファンは /proc/acpi/ibm/fan 上は停止しているように見えるが、かすかに音がしているし、負荷をかけて明らかに回っているときでも 0 なので信用できない):

Socket [0] - [physical cores=2, logical cores=4, max online cores ever=2]
  TURBO ENABLED on 2 Cores, Hyper Threading ON
  Max Frequency without considering Turbo 2593.76 MHz (99.76 x [26])
  Max TURBO Multiplier (if Enabled) with 1/2/3/4 Cores is  31x/29x/29x/29x
  Real Current Frequency 810.57 MHz [99.76 x 8.13] (Max of below)
        Core [core-id]  :Actual Freq (Mult.)      C0%   Halt(C1)%  C3 %   C6 %   C7 %  Temp      VCore
        Core 1 [0]:       798.09 (8.00x)           1    1.41       0       0    98.4    41      0.8105
        Core 2 [2]:       810.57 (8.13x)           1    1.37       0       0    98.5    41      0.8156

温度:

coretemp-isa-0000
Adapter: ISA adapter
Package id 0:  +46.0°C  (high = +87.0°C, crit = +105.0°C)
Core 0:        +46.0°C  (high = +87.0°C, crit = +105.0°C)
Core 1:        +44.0°C  (high = +87.0°C, crit = +105.0°C)

古いマシンのほうが温度が高い! Vcore が高いせいだろうか。もちろん、フォームファクタも違うので単純な比較はできないが。