端末での操作をSVG形式で記録する termtosvg

ttyrec/playみたいに端末操作を録画出来るアプリケーション.再生はウェブブラウザなどでできます.

導入はpipで

$ pip3 install termtosvg
$ termtosvg -h
usage: termtosvg [output_file] [--font FONT] [--theme THEME] [--help] [--verbose]
Record a terminal session and render an SVG animation on the fly

positional arguments:
  output_file    optional filename of the SVG animation; if missing, a random
                 filename will be automatically generated

optional arguments:
  -h, --help     show this help message and exit
  --font FONT    font to specify in the CSS portion of the SVG animation
                 (DejaVu Sans Mono, Monaco...). If the font is not installed
                 on the viewer's machine, the browser will display a default
                 monospaced font instead.
  --theme THEME  color theme used to render the terminal session (circus,
                 classic-dark, classic-light, dracula, isotope, marrakesh,
                 material, monokai, solarized-dark, solarized-light, zenburn)
  -v, --verbose  increase log messages verbosity

See also 'termtosvg record --help' and 'termtosvg render --help'

導入後実行するとそのまま端末に戻ってexitするまでの操作を記録してくれる.exitするとSVGを書き出してそのファイル名を教えてくれる.

mk@T430s:~ (551)$ termtosvg
Recording started, enter "exit" command or Control-D to end
mk@T430s:~ (554)$ cowsay -f duck "hello termtosvg!"
 __________________
< hello termtosvg! >
 ------------------
 \
  \
   \ >()_
      (__)__ _
mk@T430s:~ (555)$ cowsay -f duck "hello termtosvg!"|lolcat
 __________________
< hello termtosvg! >
 ------------------
 \
  \
   \ >()_
      (__)__ _
mk@T430s:~ (556)$ exit
Recording ended, SVG animation is /tmp/termtosvg_vpd7hh0z.svg

出来上がったファイルはSVGなので中を見てコピペとか出来なくはない.

$ xmllint --format /tmp/termtosvg_vpd7hh0z.svg|head
<?xml version="1.0" encoding="utf-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xlink="http://www.w3.org/1999/xlink" baseProfile="full" height="408" version="1.1" width="640">
  <defs>
    <style type="text/css"><![CDATA[* {font-family: "DejaVu Sans Mono", monospace; font-style: normal; font-size: 14px}
text {dominant-baseline: text-before-edge}
.bold {font-weight: bold}
.background {fill: #002b36}]]></style>
    <g id="1">
      <text fill="#93a1a1" lengthAdjust="spacingAndGlyphs" textLength="144" x="0">mk@T430s:~ (554)$ </text>
      <text fill="#002b36" lengthAdjust="spacingAndGlyphs" textLength="8" x="144"> </text>

以下にexampleがある

サーバにアップロードして共有だとasciinemaが便利だけどこれはこれでファイル一個なので便利そうです.
Python製でライセンスはBSD 3-Clause Licenseです.

Bittorrentでダウンロードしたファイルのハッシュ値が一致しなくて困る

Raspbianの新しいバージョンがリリースされていた(2018-06-27)ので,Bittorentファイルを入手してTransmission-gtkでダウンロードしました.

2018-06-27:
  * New first-boot configuration wizard added
  * Recommended Software installer added
  * Bluej, Greenfoot, NodeRED, Claws Mail, VNC Viewer removed from image - can now be installed from Recommended Applications
  * Qpdfview PDF viewer installed instead of Xpdf
  * Version 65.0 of Chromium browser included, with latest Flash player
  * Volume up / down keys now change by 5% increments and affect currently-selected output device rather than internal device only
  * Network plugin now remembers previously-entered WiFi network passwords when prompting for reconnection
  * Serial port and serial console can now be switched separately in Raspberry Pi Configuration
  * Lxkeymap keyboard language setting application removed - replaced with dialog within Raspberry Pi Configuration
  * Wifi country and keyboard language setting dialogs in Raspberry Pi Configuration now callable from other applications
  * New version of Piboto font included to render with correct weight under some rogue applications
  * Reconnection to Bluetooth audio devices on reboot improved
  * Disable click-to-rename behaviour in file manager if single-click selection enabled
  * Appearance Settings dialog makes config changes to some Qt files to match selected theme
  * MIME file type associations improved
  * Multiple desktop management options removed from mouse middle-click menu
  * Menu shortcuts to Raspberry Pi website amended
  * Python 2 IDLE menu link removed
  * Sample Magpi PDF installed in /home/pi/MagPi
  * Various minor tweaks, bug fixes and appearance changes
  * Bluetooth updates
    - Firmware with Bluetooth 4.2 features
    - SCO profile suppot added via bthelper.service
  * Linux kernel 4.14.50+
  * Raspberry Pi firmware 748fb17992426bb29d99224b93cb962fefbdc833  

一晩経って確認するとダウンロードが終わっていたので念の為ハッシュ値を確認すると合いません.

$ ls -l ./2018-06-27-raspbian-stretch-lite.zip
-rw-r--r-- 1 mk mk 366870528 6月 30 03:02 ./2018-06-27-raspbian-stretch-lite.zip
$ sha256sum 2018-06-27-raspbian-stretch-lite.zip
ce2d2babed81d5b2d6b919dc8dc92bc915a7d89f09f3aaad1d9ae01f2471eb25 2018-06-27-raspbian-stretch-lite.zip
$ echo 3271b244734286d99aeba8fa043b6634cad488d211583814a2018fc14fdca313
3271b244734286d99aeba8fa043b6634cad488d211583814a2018fc14fdca313

Transmission-gtk の該当Torrentで右クリックし,「ローカルデータを検証」を行うとダウンロードファイルが99%になりました.この状態でしばらく放置すると再度100%になり,今度はハッシュ値が合致しました.なぜこういう動きになったのかは謎です…….

shutter_18-06-30_06:29:30_001

環境

$ dpkg-query -W transmission-gtk
transmission-gtk        2.94-1+b1
$ dpkg-query -W transmission-common
transmission-common     2.94-1
$ lsb_release -d
Description:    Debian GNU/Linux unstable (sid)
$ uname -m
x86_64

GoogleのVR180ビデオ変換アプリのVR180 Creator Tool(macOS/Linux対応)

Google製のVR180のビデオ変換やYoutubeでどう見えるかのプレビューなどが可能なVR180 Creator Toolが公開されています.

ビデオエディタではなく編集やトリミングは出来ないようです.
珍しいのはWindowsに対応しておらず,macOS (10.9+)/Linux (64-bit)対応.※64-bitとあるけどx86-64(amd64)のみ.
Linux版は全部入りで展開して実行するだけでOKでした.
※手元にビデオデータがないので動作確認は出来ていない.

20180624_04:06:15-11012
20180624_04:06:09-4261

アプリ概要
VR180 Creator overview – VR180 Help

利用できる機器
Google VR

利用できるカメラ
VR180

Lenovoのやつとか欲しいですね.

180度カメラを操作するスマートフォンアプリもあるようです.

JOSMで360度カメラ写真が利用できるようになるMapillaryプラグインを試してみる

をちょっと試してみました.
試した環境はDebian sid amd64,で,Pluginの場所は~/.local/share/JOSM/plugins/でした.(~/.josm/pluginsを作るとそちらの設定が優先で全部そっちに取られて初期状態になる)
ダウンロードしたプラグインをここに置いてJOSMを起動して有効にするとオリジナル版?をダウンロードして上書きしてしまうようなので,オリジナル版を有効にした後上書きしました.

  • JOSMを起動して,Mapillaryプラグインを導入
    20180626_05:06:07-21756
    20180626_05:06:46-20695
    20180626_05:06:54-28585
  • JOSMを終了して三浦さん版Mapillaryプラグインで上書き
$ wget -O ~/.local/share/JOSM/plugins/Mapillary.jar 'https://bintray.com/osmfj/JOSM/download_file?file_path=Mapillary.jar'
$ sha256sum /home/mk/.local/share/JOSM/plugins/Mapillary.jar
e6961ceb8381ea3eddec7c457edfe5a2bcea593f43ce9a9b75a9214396be5ac8  /home/mk/.local/share/JOSM/plugins/Mapillary.jar
  • JOSMを起動してshift+,してMapillaryレイヤーを有効にして適当な場所で360度カメラ画像を探す.今回は横浜のシルクセンター前辺り.
    • (エラーが出たら無視して強行)
  • 見やすくするためにMapillary窓の📍をクリックして別ウィンドウにする
  • 初期は歪んだ画像だが,クリックすると補正される
  • クリックした場所がセンターになる
  • 360度回転できる画像と端で止まる画像がある?

out.resized

いい感じですね.360度カメラや180度カメラ,せめてアクションカムが欲しいところです…….



#そういえば先日Googleから180度カメラのビデオ変換アプリケーションが出ました.macOS/Linux対応.(WIndows非対応!) -> VR180 Apps

試した環境

$ java -jar ~/bin/josm-latest.jar --version
JOSM/1.5 (13974 ja) Linux Debian GNU/Linux unstable (sid)
$ java -version
openjdk version "10.0.1" 2018-04-17
OpenJDK Runtime Environment (build 10.0.1+10-Debian-4)
OpenJDK 64-Bit Server VM (build 10.0.1+10-Debian-4, mixed mode)
$ dpkg-query -W openjdk-10-jre
openjdk-10-jre:amd64    10.0.1+10-4
$ lsb_release -d
Description:    Debian GNU/Linux unstable (sid)
$ uname -m
x86_64

Windows用Notepad++をsnapパッケージでLinuxに導入

WindowsアプリケーションのNotepad++がWineとセットでsnapパッケージにされているらしいです.但し非公式.
winepackはFactpak化だったのでそれのsnap版みたいな感じですね.(こっちは単一のアプリケーションだけだけど)

snapなので試すのは簡単です.

$ sudo snap remove notepad-plus-plus

試しに動かすと日本語は豆腐になってしまいます.多分フォントを入れれば解決する?

20180624_05:06:09-22454

~/snap/notepad-plus-plus/common/.wineにwineの設定があるのでその下のdrive_c/windows/Fontsを覗いたらhostのsystemのfont全てにシンボリックリンク貼ってあったのでフォントは入ってそうです.
Notepad++の設定で適当なフォントを指定したら豆腐直りました.
設定は,「setting」->「preference」「日本語」を指定,「設定」->「スタイル設定」で適当な日本語対応フォントを指定.ここで「Global style : Default style」のフォントを指定でとりあえずデフォルトの画面での豆腐は直りましたが,沢山スタイルあるのでこれ設定するの面倒そうです.(常用するならシステムのフォントも変えたほうが見やすくなりそうですね)

20180624_06:06:52-32246

20180624_06:06:55-8334

そしてちょっと使ってやっぱりXのバッファが使えないのが辛いので消しました><

$ sudo snap remove notepad-plus-plus

Windowsでこのアプリケーションを利用している人にはお手軽に導入できて良さそうです.

Flickrにコマンドラインから画像をアップロードするFlickr-Uploadを試す

何時もはflickcurlを利用しているのですが,複数のアカウントに対応していないようなので別のツールを探してFlickr-Uploadを見つけました.

const char* config_filename = ".flickcurl.conf";

Install

$ sudo apt install libflickr-upload-perl

認証

  • URLを開くと認証画面になるので許可する
  • リダイレクトでダミーURLに飛ばされるのでそのURLをURL:のところに貼り付ける
$ flickr_upload --oauth
Please open this URL in your browser and follow the instructions:

https://api.flickr.com/services/oauth/authorize?oauth_token=72157697799378834-ad02ea9a475eac80&perms=write

When you authorize this app, you'll be directed to a dummy URL
that contains a confirmation code. Paste that URL here.

URL: https://127.0.0.1/?oauth_token=999999999999999999-deadbeefdeadbeef&oauth_verifier=123456bdeadbeef
Saving OAuth credentials to /home/mk/.flickroauth.st
Uploading /home/mk/.flickrrc...Can't read photo '/home/mk/.flickrrc' at /usr/share/perl5/Flickr/Upload.pm line 128, <STDIN> line 1.
  • ~/.flickroauth.st に認証ファイルが作られる
$ ls -l /home/mk/.flickroauth.st
-rw-r--r-- 1 mk mk 673  6月 24 08:47 /home/mk/.flickroauth.st

アップロード

$ flickr_upload --public 1 ~/Pictures/20180624_06:06:55-8334.jpg
Uploading /home/mk/Pictures/20180624_06:06:55-8334.jpg...
Waiting for upload results (ctrl-C if you don't care)...
/home/mk/Pictures/20180624_06:06:55-8334.jpg is at https://www.flickr.com/tools/uploader_edit.gne?ids=12345678902

10分毎に自動アップロード

2,12,22,32,42,52 * * * *    D=`date +\%m\%d\%H\%M.\%S` ; find ~/Pictures -newer ${HOME}/Pictures/.flickr_time \( -iname "*.jpg" -o -iname "*.png" \) -type f -print0 | xargs -0 -r -n1 flickr_upload --public 0 --tag 'autoupload' && touch -t ${D} ${HOME}/Pictures/.flickr_time

*/10+2とかできればいいのに

環境

$ dpkg-query -W libflickr-upload-perl
libflickr-upload-perl   1.60-1
$ lsb_release -d
Description:    Debian GNU/Linux unstable (sid)
$ uname -m
x86_64

Sigfoxのエリアなどを確認

Sigfoxのエリアってまだまだだよなーと思ってたのですが,siteを見に行ったら

以下のスケジュールで順次サービスエリアを拡大していきます。

2017年3月 東京23区、横浜市、川崎市、大阪市
2018年3月 政令指定都市を含む主要36都市
2020年3月 全国

思っていたよりエリア広がってそうです.
以下のページでエリアを確認してみると鹿児島市市街地や錦江湾あたりはOKそうです.

20180619_05:06:43-16494
20180619_05:06:05-16518

デバイスの入手性や価格はどうだろうと以下のあたりを見ると,Arduinoシールドなんかは入手できるお店も多くて試しやすそうです.入手性は悪そうだけど下の方のInnoComm Mobile Technology社のSigfox モジュール-SN10-23,ワイソル社のWSSFM20R3とかのSigfox, Wi-Fi, BLE, GPS入りコンボモジュールとか便利そうですね.自転車に積んで位置情報と振動情報とかを飛ばしたりしたいです.ESP社のESP-WROOM-32みたいに入手性が良くなったら試してみたいところです.

Mountainから山が消えて困る

Steamは今日からサマーセールですが,なんとなく久々にSteamのMountainを起動すると山が居ません.

20180622_02:06:49-1858

本来なら宇宙の中にこの靄に囲まれた山があるはずなんですが居ません.キーを叩くとピアノが弾けるはずなのですがこれも無反応..で山の意思は聞こえます.

コミニュティガイドを見ながら以下のあたりを試そうとするもピアノが弾けないせいか反応がありません.

リセット : SBN,ASSSS
山を作り直す。(今の山は消滅する。)

隠しメニュー : FS,N,SFS,N,S,
山の年齢や木の数などが見られる。
LOADで事前にセーブした時点の山まで戻ることができる。
REGENは山を作り直す。

多分データがおかしくなったのだろうとアンインストールしてインストールし直しても駄目です.Windows/Macでは以下のような情報が.

データの初期化方法
山がバグってどうしようもなくなった人が居たので(山を破壊するコマンドも無意味だった)データ初期化の方法を記しておきます。

Windows: C:\Users\USERNAME\AppData\LocalLow\Trash\Mountain
Mac:   Users\Library\Caches\Unity.Trash.Mountain

にあるファイルを削除すれば初期化することができます。

findコマンドの-mmin~/.steam, ~/.config辺りを探してみるとそれらしいディレクトリを発見.
'~/.config/unity3d/David OReilly' このディレクトリを退避してみましたが変化はありません.

SteamのMountainのプロパティを見てみると,「アップデート」タブに「Steam クラウド」という項目がありました.

20180622_01:06:30-22237

このチェックを外して,'~/.config/unity3d/David OReilly'を削除してみたところ初期状態になりました!

20180622_02:06:24-2233

そして新しい山が作れました :)

20180622_02:06:12-2785

てことで山を眺めることが出来るようになりました.

20180622_02:06:27-2930

Mountainが気になる人は7/6迄サマーセール49% offで50円なので気になる方は買ってみてはどうでしょう.操作はコミニュティガイドの日本語を読むと良いです.Linux版もあるのでWineSteamとかを挟まなくても遊べます.

ところで先日移動中にMauntainのような桜島を見かけました.
IMGP5151IMGP5160IMGP5162IMGP5164

Android端末をshellで操作できるTermux:APIで遊んでみた

※この記事は「鹿児島Linux勉強会 2018.06」で発表したものに社会性フィルタをかけて加筆修正したものです.鹿児島らぐでは月一回位をペースにオフ会を行っています.

TermuxはAndroid上でLinux環境を構築するアプリケーションです.他に標準のLinuxディストリビューションがchroot環境で動作するソフトウェアが色々ある(Debian no root等)ので独自パッケージ管理なTermuxにはあまり惹かれていなかったのですが,API経由でAndroidデバイスの操作が出来るということを知り試してみました.

入手先

API利用時にはAPIアプリも導入が必要

※互換性の問題があるのでF-DroidとGoogle Playのアプリは混在させてはいけないらしいので注意.

要件

Android 5.0 or newer.

Permissions

Permissions
android.permission.INTERNET
android.permission.WRITE_EXTERNAL_STORAGE
android.permission.WAKE_LOCK
android.permission.VIBRATE
android.permission.READ_EXTERNAL_STORAGE

api pkg導入

Termux上で実行

$ pkg install termux-api

APIを試す

はじめTermux:APIで紹介されているものを確認しました.

パッケージを確認すると他にもコマンドがあったのでそちらも確認し直しました.

dpkg -L termux-api|grep /bin/|cut -d\/ -f8|sort
termux-audio-info
termux-battery-status
termux-brightness
termux-call-log
termux-camera-info
termux-camera-photo
termux-clipboard-get
termux-clipboard-set
termux-contact-list
termux-dialog
termux-download
termux-fingerprint
termux-infrared-frequencies
termux-infrared-transmit
termux-location
termux-media-player
termux-media-scan
termux-microphone-record
termux-notification
termux-notification-remove
termux-sensor
termux-share
termux-sms-inbox
termux-sms-send
termux-speech-to-text
termux-storage-get
termux-telephony-call
termux-telephony-cellinfo
termux-telephony-deviceinfo
termux-toast
termux-torch
termux-tts-engines
termux-tts-speak
termux-vibrate
termux-volume
termux-wallpaper
termux-wifi-connectioninfo
termux-wifi-enable
termux-wifi-scaninfo

基本的にjson形式で結果は帰って来ます.使い方がわからない場合は-hオプションで簡易helpが表示されます.パーミッションを求められる場合はダイアログが表示されるので許可してあげる必要があります.(その回は失敗する)

SIMや赤外線通信の使えるAndroid 5以上の端末が手元にないのでその辺りの物は試せてません.

  • termux-audio-info

    オーディオ情報の取得

      $ termux-audio-info -h
      Usage: termux-audio-info
      Get information about audio capabilities.
      $ termux-audio-info  
      {
        "PROPERTY_OUTPUT_SAMPLE_RATE": "48000",
        "PROPERTY_OUTPUT_FRAMES_PER_BUFFER": "960",
        "STREAM_MUSIC_VOLUME": 1,
        "STREAM_MUSIC_MAXVOLUME": 15,
        "BLUETOOTH_A2DP_IS_ON": false,
        "WIREDHEADSET_IS_CONNECTED": false,
        "AUDIOTRACK_NATIVE_OUTPUT_SAMPLE_RATE": 48000
      }
    
  • termux-battery-status

    バッテリー情報の取得

    $ termux-battery-status -h
    Usage: termux-battery-status
    Get the status of the device battery.
    $ termux-battery-status
    {
      "health": "GOOD",
      "percentage": 70,
      "plugged": "PLUGGED_USB",
      "status": "CHARGING",
      "temperature": 36.900001525878906
    }
    
  • termux-brightness

    輝度の調整?0や255を指定しても動作が解らなかった

    $ termux-brightness
    Usage: termux-brightness brightness
    Set the screen brightness between 0 and 255
    $ termux-brightness 0
    $ termux-brightness 255
    
  • termux-call-log

    通話履歴の取得

    $ termux-call-log -h
    Usage: termux-call-log [-d] [-l limit] [-o offset]
    List call log history
      -l limit   offset in call log list (default: 10)
      -o offset  offset in call log list (default: 0)
    $ termux-call-log
    
  • termux-camera-info

    カメラ情報が取得できる.カメラIDや解像度など.

    $ termux-camera-info -h
    Usage: termux-camera-info
    Get information about device camera(s).
    $ termux-camera-info
    [
      {
        "id": "0",
        "facing": "back",
        "jpeg_output_sizes": [
          {
            "width": 5248,
            "height": 3936
          },
          {
            "width": 5248,
            "height": 2952
          },
          {
            "width": 3840,
            "height": 2160
          },
          {
            "width": 3264,
            "height": 2448
          },
          {
            "width": 2048,
            "height": 1536
          },
          {
            "width": 1920,
            "height": 1080
          },
          {
            "width": 1280,
            "height": 720
          },
          {
            "width": 640,
            "height": 480
          },
          {
            "width": 480,
            "height": 320
          },
          {
            "width": 320,
            "height": 240
          }
        ],
        "focal_lengths": [
          4.900000095367432
        ],
        "auto_exposure_modes": [
          "CONTROL_AE_MODE_ON",
          "CONTROL_AE_MODE_ON_AUTO_FLASH",
          "CONTROL_AE_MODE_ON_ALWAYS_FLASH",
          "CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE"
        ],
        "physical_size": {
          "width": 6.219269752502441,
          "height": 4.663866996765137
        },
        "capabilities": [
          "backward_compatible"
        ]
      },
      {
        "id": "1",
        "facing": "front",
        "jpeg_output_sizes": [
          {
            "width": 1920,
            "height": 1080
          },
          {
            "width": 1600,
            "height": 1200
          },
          {
            "width": 1280,
            "height": 720
          },
          {
            "width": 640,
            "height": 480
          },
          {
            "width": 480,
            "height": 320
          },
          {
            "width": 320,
            "height": 240
          }
        ],
        "focal_lengths": [
          1.809999942779541
        ],
        "auto_exposure_modes": [
          "CONTROL_AE_MODE_ON"
        ],
        "physical_size": {
          "width": 2.1837236881256104,
          "height": 1.2063192129135132
        },
        "capabilities": [
          "backward_compatible"
        ]
      }
    ]
    
  • termux-camera-photo

    カメラを使って写真撮影が出来る.引数にカメラID(option)や写真ファイル名(必須)が指定できる.写真はJPEG形式

    $ termux-camera-photo -h
    
    Usage: termux-camera-photo [-c camera-id] output-file
    Take a photo and save it to a file in JPEG format.
      -c camera-id  ID of the camera to use (see termux-camera-info), default: 0
    $ termux-camera-photo termix_photo.jpg
    
  • termux-clipboard-get

    クリップボードの文字列を取得

    $ termux-clipboard-get -h
    Usage: termux-clipboard-get
    Get the system clipboard text.
    
  • termux-clipboard-set

    クリップボードに文字列を格納

    $ termux-clipboard-set -h
    Usage: termux-clipboard-set [text]
    Set the system clipboard text. The text to set is either supplied as arguments or read from stdin if no arguments are given.
    $ termux-clipboard-set hello
    $ termux-clipboard-get
    hello
    
  • termux-contact-list

    全てのコンタクトリストが表示される

    $ termux-contact-list -h
    Usage: termux-contact-list
    List all contacts.
    $ termux-contact-list
    [
      {
        "name": "MATOHARA Kenichiro",
        "number": "0X0-XXXX-XXXX"
      },
         :
    
  • termux-dialog

    ダイヤログを表示してその結果を取得できる.パスワード文字列などの指定も可能.

    $ termux-dialog -h
    Usage: termux-dialog [-i hint] [-m] [-p] [-t title]
    Show a text entry dialog.
      -i hint   the input hint to show when the input is empty
      -m        use a textarea with multiple lines instead of a single
      -p        enter the input as a password
      -t title  the title to show for the input prompt
    
    $ echo `termux-dialog`
    hoge
    

    28037547727_edb2027c2c_o

    $ echo `termux-dialog -i hint -m -t termux\ dialog`|od -xc
    0000000   h   o   g   e       f   u   g   a  \n
            6f68 6567 6620 6775 0a61
    0000012
    

    28037548487_5ff4a35999_o

    $ echo `termux-dialog -p`
    passwordddd
    

    42188267074_de542c5ee6_o

  • termux-download

    指定したURLからダウンロードが出来る.Androidのダウンロードアプリに渡される.(単にファイル取得ならwgetが入っている)

    $ termux-download -h
    Usage: termux-download [-d description] [-t title] url-to-download
    Download a resource using the system download manager.
      -d description  description for the download request notification
      -t title        title for the download request notification
    
  • termux-fingerprint

    指紋認証を行う?(未確認)

    $ termux-fingerprint -h
    Usage: termux-fingerprint
    Use fingerprint sensor on device to check for authentication
    NOTE: Only available on Marshmallow and later
    $ termux-fingerprint
    {
      "errors": [
        "ERROR_UNSUPPORTED_OS_VERSION"
      ],
      "failed_attempts": 0,
      "auth_result": "AUTH_RESULT_UNKNOWN"
    
  • termux-infrared-frequencies

    赤外線通信情報を取得?(未確認)

    $ termux-infrared-frequencies -h
    Usage: termux-infrared-frequencies
    Query the infrared transmitter's supported carrier frequencies.
    $ termux-infrared-frequencies
    []
    
  • termux-infrared-transmit

    赤外通信で送信する?(未確認)

    $ termux-infrared-transmit -h
    Usage: termux-infrared-transmit -f frequency pattern
    Transmit an infrared pattern. The pattern is specified in comma-separated on/off intervals, such as '20,50,20,30'. Only patterns shorter than 2 seconds will be transmitted.
      -f frequency  IR carrier frequency in Hertz
    
  • termux-location

    位置情報を取得.GPSを利用すると時間が掛かる.位置情報が取得できない場合はタイムアウト後何も帰ってこない.タイムアウトは65秒前後.

    $ termux-location -h
    usage: termux-location [-p provider] [-r request]
    Get the device location.
      -p provider  location provider [gps/network/passive] (default: gps)
      -r request   kind of request to make [once/last/updates] (default: once)
    $ termux-location -p gps
    $ termux-location -p network  
    {
      "latitude": 31.2529767,
      "longitude": 130.8509959,
      "altitude": 0.0,
      "accuracy": 19.31999969482422,
      "bearing": 0.0,
      "speed": 0.0,
      "elapsedMs": 39,
      "provider": "network"
    }
    $ termux-location -p passive
    {
      "latitude": 34.77000045776367,
      "longitude": 138.4600067138672,
      "altitude": 0.0,
      "accuracy": 976974.0625,
      "bearing": 81.0,
      "speed": 0.0,
      "elapsedMs": 5,
      "provider": "fused"
    }
    
  • termux-media-player
    メディアの再生,操作

    $ termux-media-player -h
    termux-media-player: Invalid cmd: '-h'
    Usage: termux-media-player cmd [args]
    
    help        Shows this help
    info        Displays current playback information
    play        Resumes playback if paused
    play <file> Plays specified media file
    pause       Pauses playback
    stop        Quits playback
    $ termux-media-player play 
    No previous track to resume!
    Please supply a new media file
    $ termux-media-player play /storage/sdcard1/Android/data/com.bambuna.podcastaddict/files/podcast/エッジのたたないポッドキャスト/MzoRbgzFVe_3248.mp3
    Now Playing: MzoRbgzFVe_3248.mp3
    $ termux-media-player pause
    Paused playback
    $ termux-media-player play
    Resumed playback
    Track: MzoRbgzFVe_3248.mp3
    Current Position: 00:27 / 13:39
    $ termux-media-player info  
    Status: Playing
    Track: MzoRbgzFVe_3248.mp3
    Current Position: 01:10 / 13:39
    $ termux-media-player info
    No track currently!
    $ termux-media-player play photo.jpg
    
    Prepare failed.: status=0x1
    
  • termux-media-scan

    メディアをスキャンする?

    $ termux-media-scan -h
    Usage: termux-media-scan [-v] [-r] file [file...]
    Scan the specified file(s) and add it to the media content provider.
      -r  scan directories recursively
      -v  verbose mode
    $ termux-media-scan -r /storage/sdcard1/Android/data/com.bambuna.podcastaddict/files/podcast/エッジのたたないポッドキャスト
    Finished scanning 2 file(s)
    $ termux-media-scan -r -v /storage/sdcard1/Android/data/com.bambuna.podcastaddict/files/podcast/エッジのたたないポッドキャスト
    /storage/sdcard1/Android/data/com.bambuna.podcastaddict/files/podcast/エッジのたたないポッドキャスト
    /storage/sdcard1/Android/data/com.bambuna.podcastaddict/files/podcast/エッジのたたないポッドキャスト/MzoRbgzFVe_3248.mp3
    Finished scanning 2 file(s)
    $ termux-media-player info
    No track currently!
    
  • termux-microphone-record

    録音をする.出力ファイル形式は3GPPのよう

    $ termux-microphone-record -h
    Usage: termux-microphone-record [args]
    Record using microphone on your device
    
    -h           Shows this help
    -d           Start recording w/ defaults
    -f <file>    Start recording to specific file
    -l <limit>   Start recording w/ specified limit (in seconds)
    -i           Get info about current recording
    -q           Quits recording
    $ termux-microphone-record -d -f termux-record.mp3 -l 10
    Recording started: /data/data/com.termux/files/home/termux-record 
    Max Duration: 00:10
    $ termux-microphone-record -i
    {
      "isRecording": true,
      "outputFile": "\/data\/data\/com.termux\/files\/home\/termux-record"
    }
    $ termux-microphone-record -i
    {
      "isRecording": false
    }
    file ./termux-record
    ./termux-record: ISO Media, MPEG v4 system, 3GPP
    $ mv ./termux-record ./termux-record.3gpp
    $ termux-media-player play ./termux-record.3gpp
    Now Playing: termux-record.3gpp
    
  • termux-notification

    通知を出力する.タイトル,メッセージ以外にもバイブレーションやサウンド,LEDなども操作できる.

    $ termux-notification -h
    Usage: termux-notification [options]
    Display a system notification. Context text is read from stdin or specified using --content.
      --action action          action to execute when pressing the notification
      --button1 text           text to show on the first notification button
      --button1-action action  action to execute on the first notification button
      --button2 text           text to show on the second notification button
      --button2-action action  action to execute on the second notification button
      --button3 text           text to show on the third notification button
      --button3-action action  action to execute on the third notification button
      --content content        content to show in the notification. Read from stdin not specified here.
      --id id                  notification id (will overwrite any previous notification with the same id)
      --led-color rrggbb       color of the blinking led as RRGGBB (default: none)
      --led-on milliseconds    number of milliseconds for the LED to be on while it's flashing (default: 800)
      --led-off milliseconds   number of milliseconds for the LED to be off while it's flashing (default: 800)
      --on-delete action       action to execute when the the notification is cleared
      --priority prio          notification priority (high/low/max/min/default)
      --sound                  play a sound with the notification
      --title title            notification title to show
      --vibrate pattern        vibrate pattern, comma separated as in 500,1000,200
    $ termux-notification --title hoge --content fuga
    

    Screenshot_2018-06-21-00-54-59

  • termux-notification-remove

    termux-notification -idで指定したidのメッセージを削除する.

    $ termux-notification-remove -h
    Usage: termux-notification-remove notification-id
    Remove a notification previously shown with termux-notification --id.
    $ termux-notification --content hoge --id tm01
    $ termux-notification-remove tm01
    
  • termux-sensor

    センサーの値を取得する.センサーの値は定期的に表示される(既定値は多分1秒間隔)

    $ termux-sensor -h
    Usage: termux-sensor
    Get information about types of sensors as well as live data
      -h, help           Show this help
      -a, all            Listen to all sensors (WARNING! may have battery impact)
      -c, cleanup        Perform cleanup (release sensor resources)
      -l, list           Show list of available sensors
      -s, sensors [,,,]  Sensors to listen to (can contain just partial name)
      -d, delay [ms]     Delay time in milliseconds before receiving new sensor update
    $ termux-sensor -l
    {
      "sensors": [
        "BMA2X2 Accelerometer\/Temperature\/Double-tap",
        "AK8963 Magnetometer",
        "AK8963 Magnetometer Uncalibrated",
        "BMG160 Gyroscope",
        "BMG160 Gyroscope Uncalibrated",
        "APDS-9930\/QPDS-T930 Proximity & Light",
        "APDS-9930\/QPDS-T930 Proximity & Light",
        "Gravity",
        "Linear Acceleration",
        "Rotation Vector",
        "Step Detector",
        "Step Counter",
        "Significant Motion Detector",
        "Game Rotation Vector",
        "GeoMagnetic Rotation Vector",
        "Orientation"
      ]
    }
    $ termux-sensor -s "BMA2X2 Accelerometer\/Temperature\/Double-tap"
    No valid sensors were registered!
    $ termux-sensor -s "AK8963 Magnetometer"
    {
      "AK8963 Magnetometer": {
        "values": [
          -11.248207092285156,
          -37.157630920410156,
          23.89850616455078
        ]
      }
    }
    {
      "AK8963 Magnetometer": {
        "values": [
          16.16058349609375,
          -33.7738037109375,
          -13.971900939941406
        ]
      }
    }
    {
      "AK8963 Magnetometer": {
        "values": [
          3.6207199096679688,
          -38.532447814941406,
          -17.789649963378906
        ]
      }
    }
    ^CCaught interrupt.. Finishing...
    Performing sensor cleanup
    Sensor cleanup successful!
    $ termux-sensor -s "AK8963 Magnetometer Uncalibrated"
    {
      "AK8963 Magnetometer Uncalibrated": {
        "values": [
          -18.68438720703125,
          -71.844482421875,
          195.37200927734375,
          -26.05126953125,
          -30.462646484375,
          221.81549072265625
        ]
      }
    }
    {
      "AK8963 Magnetometer Uncalibrated": {
        "values": [
          -18.6492919921875,
          -70.87860107421875,
          196.197509765625,
          -26.05126953125,
          -30.462646484375,
          221.81549072265625
        ]
      }
    }
    ^CCaught interrupt.. Finishing...
    Performing sensor cleanup
    Sensor cleanup successful!
    $ termux-sensor -s "BMG160 Gyroscope"
    {
      "BMG160 Gyroscope": {
        "values": [
          8.544921875E-4,
          8.087158203125E-4,
          8.544921875E-4
        ]
      }
    }
    ^CCaught interrupt.. Finishing...
    Performing sensor cleanup
    Sensor cleanup successful!
    $ termux-sensor -s "BMG160 Gyroscope Uncalibrated"
    {
      "BMG160 Gyroscope Uncalibrated": {
        "values": [
          -0.006317138671875,
          0.002044677734375,
          0,
          -0.006103517021983862,
          0.0012359619140625,
          -8.544921875E-4
        ]
      }
    }
    ^CCaught interrupt.. Finishing...
    Performing sensor cleanup
    Sensor cleanup successful!
    $ termux-sensor -s "APDS-9930\/QPDS-T930 Proximity & Light"
    No valid sensors were registered!
    $ termux-sensor -s "Gravity"
    {
      "Gravity": {
        "values": [
          1.4136531352996826,
          -1.045373558998108,
          9.647754669189453
        ]
      }
    }
    ^CCaught interrupt.. Finishing...
    Performing sensor cleanup
    Sensor cleanup successful!
    $ termux-sensor -s "Linear Acceleration"
    {
      "Linear Acceleration": {
        "values": [
          -0.0018668174743652344,
          0.005246162414550781,
          0.001544952392578125
        ]
      }
    }
    ^CCaught interrupt.. Finishing...
    Performing sensor cleanup
    Sensor cleanup successful!
    $ termux-sensor -s "Rotation Vector"
    {
      "Rotation Vector": {
        "values": [
          0.07332251220941544,
          -0.0574394166469574,
          0.9877411723136902,
          0.12526708841323853,
          0.1745329201221466
        ]
      }
    }
    ^CCaught interrupt.. Finishing...
    Performing sensor cleanup
    Sensor cleanup successful!
    $ termux-sensor -s "Step Detector"
    {}
    ^CCaught interrupt.. Finishing...
    Performing sensor cleanup
    Sensor cleanup successful!
    $ termux-sensor -s "Step Counter"
    {
      "Step Counter": {
        "values": [
          0
        ]
      }
    }
    ^CCaught interrupt.. Finishing...
    Performing sensor cleanup
    Sensor cleanup successful!
    $ termux-sensor -s "Significant Motion Detector"
    {}
    {}
    ^CCaught interrupt.. Finishing...
    Performing sensor cleanup
    Sensor cleanup successful!
    $ termux-sensor -s "Game Rotation Vector"
    {
      "Game Rotation Vector": {
        "values": [
          -0.04727154225111008,
          -0.08051935583353043,
          0.005690218415111303,
          0.9956152439117432
        ]
      }
    }
    ^CCaught interrupt.. Finishing...
    Performing sensor cleanup
    Sensor cleanup successful!
    $ termux-sensor -s "GeoMagnetic Rotation Vector"
    {
      "GeoMagnetic Rotation Vector": {
        "values": [
          0.07260913401842117,
          -0.05879773199558258,
          0.9851652383804321,
          0.14394499361515045,
          0.1745329201221466
        ]
      }
    }
    ^CCaught interrupt.. Finishing...
    Performing sensor cleanup
    Sensor cleanup successful!
    $ termux-sensor -s "Orientation"
    {
      "Orientation": {
        "values": [
          194.80770874023438,
          5.517017364501953,
          9.214399337768555
        ]
      }
    }
    ^CCaught interrupt.. Finishing...
    Performing sensor cleanup
    Sensor cleanup successful!
    
  • termux-share

    引数に指定されたファイルを共有する.

    $ termux-share -h
    Usage: termux-share [-a action] [-c content-type] [-d] [-t title] [file]
    Share a file specified as argument or the text received on stdin if no file argument is given.
      -a action        which action to performed on the shared content:
                         edit/send/view (default:view)
      -c content-type  content-type to use (default: guessed from file extension,
                         text/plain for stdin)
      -d               share to the default receiver if one is selected
                         instead of showing a chooser
      -t title         title to use for shared content (default: shared file name)
    $ termux-share photo.jpg 
    
  • termux-sms-inbox

    受信済のSMSメッセージを読み込む.(未確認.SIMなし端末で試したら0件表示された)

    $ termux-sms-inbox -h
    Usage: termux-sms-inbox [-d] [-l limit] [-n] [-o offset]
    List received SMS messages.
      -d         show dates when messages were created
      -l limit   offset in sms list (default: 10)
      -n         show phone numbers
      -o offset  offset in sms list (default: 0)
    $ termux-sms-inbox
    
  • termux-sms-send

    smsメッセージを送信する.(未確認)

    $ termux-sms-send -h
    Usage: termux-sms-send -n number[,number2,number3,...] [text]
    Send a SMS message to the specified recipient number(s). The text to send is either supplied as arguments or read from stdin if no arguments are given.
      -n number(s)  recipient number(s) - separate multiple numbers by commas
    $ termux-sms-send -n 電話番号 message
    
  • termux-speech-to-text

    音声認識した結果を表示する.端末上では空行しか見えないがodに流すと文字列が帰っているのが解る.多分英語のみ?

    $ termux-speech-to-text -h
    Usage: termux-speech-to-text
    Converts speech to text, sending partial matches to stdout.
    $ termux-speech-to-text
    
    
    
    
    
    $ termux-speech-to-text|od -xc
    0000000  \n  \n  \n   H   u   d   l  \n
            0a0a 480a 6475 0a6c
    0000010
    
  • termux-storage-get

    システムに指定したファイルを渡して開く?反応がない.

    $ termux-storage-get -h
    Usage: termux-storage-get output-file
    Request a file from the system and output it to the specified file.
    $ termux-storage-get photo.jpg 
    
  • termux-telephony-call

    指定した番号に電話を掛ける(mobile回線は未確認だが,電話のみでもアプリ選択画面にはなるのでWi-FiのみでもSIPなどで電話することは多分可能)

    $ termux-telephony-call -h
    Usage: termux-telephony-call <number>
    Call a telephony number.
    $ termux-telephony-call 電話番号
    
  • termux-telephony-cellinfo

    電話基地局情報を取得?

    $ termux-telephony-cellinfo -h
    Usage: termux-telephony-cellinfo
    Get information about all observed cell information from all radios on the device including the primary and neighboring cells.
    $ termux-telephony-cellinfo
    [
      {
        "type": "wcdma",
        "registered": true,
        "asu": 6,
        "dbm": -101,
        "level": 2,
        "cid": 249053510,
        "lac": 25994,
        "mcc": 440,
        "mnc": 10,
        "psc": 33
      }
    ]
    

     

  • termux-telephony-deviceinfo

    テレフォニーデバイス情報を取得?

    $ termux-telephony-deviceinfo -h
    Usage: termux-telephony-deviceinfo
    Get information about the telephony device.
    $ termux-telephony-deviceinfo
    {
      "data_activity": "none",
      "data_state": "disconnected",
      "device_id": "357931051XXXXXXX",
      "device_software_version": "81",
      "phone_type": "gsm",
      "network_operator": "",
      "network_operator_name": "",
      "network_country_iso": "",
      "network_type": "unknown",
      "network_roaming": false,
      "sim_country_iso": "",
      "sim_operator": "",
      "sim_operator_name": "",
      "sim_serial_number": null,
      "sim_subscriber_id": null,
      "sim_state": "absent"
    }
    
  • termux-toast

    Toast(一時的なポップアップ)メッセージを表示する

    $ termux-toast -h
    Usage: termux-toast [-s] [text]
    Show text in a Toast (a transient popup). The text to show is either supplied as arguments or read from stdin if no arguments are given.
     -s  only show the toast for a short while
    $ termux-toast hello
    

    Screenshot_2018-06-21-01-57-40

  • termux-torch

    トーチをon/offする?手元の環境では反応がなかった.

    $ termux-torch -h
    Illegal parameter: -h
    Usage: termux-torch [on | off]
    Toggle LED Torch on device
    $ termux-torch on
    ^C
    
  • termux-tts-engines

    テキスト読み上げエンジン(tts)の一覧を表示する

    $ termux-tts-engines -h
    Usage: termux-tts-engines
    Get information about the available text-to-speech (TTS) engines. The name of an engine may be given to the termux-tts-speak command using the -e option.
    $ termux-tts-engines
    [
      {
        "name": "com.google.android.tts",
        "label": "Googleテキスト読み上げエンジン",
        "default": false
      },
      {
        "name": "jp.kddilabs.n2tts",
        "label": "KDDILABS N2 TTS",
        "default": true
      }
    ]
    
  • termux-tts-speak

    テキスト読み上げを行う.日本語に対応したttsであれば日本語も問題ない.標準入力からも受け付けるので記事や小説の読み上げも簡単.

    $ termux-tts-speak こんにちは
    $ echo '吾輩は猫である' | termux-tts-speak
    $ w3m -dump https://www.aozora.gr.jp/cards/000148/files/789_14547.html | termux-tts-speak
    
  • termux-vibrate

    バイブレートを実行.長さの指定やサイレントモードでも強行するモードもある.

    $ termux-vibrate -h
    Usage: termux-vibrate [-d duration] [-f]
    Vibrate the device.
      -d duration  the duration to vibrate in ms (default:1000)
      -f           force vibration even in silent mode
    $ termux-vibrate
    
  • termux-volume
    ボリュームの変更.手元の環境では0〜15で数字が大きいほど音量が大きくなった.16以上を指定しても15と同じ動きになった.

    $ termux-volume -h
    Invalid argument count
    Usage: termux-volume stream volume
    Change volume of audio stream
    Valid audio streams are: alarm, music, notification, ring, system, call
    Call w/o arguments to show information about each audio stream
    $ termux-volume music 5
    
  • termux-wallpaper

    壁紙を設定.位置合わせや切り抜き指定は出来ない.-uが便利.

    $ termux-wallpaper -h
    Change wallpaper on your device
    
    Usage: termux-wallpaper cmd [args]
    -h         show this help
    -f <file>  set wallpaper from file
    -u <url>   set wallpaper from url resource
    -l         set wallpaper for lockscreen (Nougat and later)
    $ termux-wallpaper -u https://www.nasa.gov/sites/default/files/styles/full_width_feature/public/thumbnails/image/pia22422.jpg
    Wallpaper set successfully!
    
  • termux-wifi-connectioninfo

    Wi-Fi接続情報を表示.

    $ termux-wifi-connectioninfo -h
    Usage: termux-wifi-connectioninfo
    Get information about the current wifi connection.
    $ termux-wifi-connectioninfo
    {
      "bssid": "10:6f:3f:XX:XX:XX",
      "frequency_mhz": 2462,
      "ip": "192.168.2.211",
      "link_speed_mbps": 54,
      "mac_address": "68:76:4f:XX:XX:XX",
      "network_id": 0,
      "rssi": -51,
      "ssid": "home-ap",
      "ssid_hidden": false,
      "supplicant_state": "COMPLETED"
    }
    
  • termux-wifi-enable

    Wi-Fiの有効無効設定.

    $ termux-wifi-enable -h
    Usage: termux-wifi-enable [true | false]
    Toggle Wi-Fi On/Off
    $ termux-wifi-enable false
    
    $ termux-wifi-enable true
    
    
  • termux-wifi-scaninfo

    Wi-Fiスキャン結果を表示.

    $ termux-wifi-scaninfo -h
    Usage: termux-wifi-scaninfo
    Get information about the last wifi scan.
    $ termux-wifi-scaninfo
    [
      {
        "bssid": "12:6f:3f:XX:XX:XX",
        "frequency_mhz": 2462,
        "rssi": -55,
        "ssid": "home-guest",
        "timestamp": 2978153233
      },
      {
        "bssid": "10:6f:3f:XX:XX:XX",
        "frequency_mhz": 2462,
        "rssi": -54,
        "ssid": "home-ap",
        "timestamp": 2978153243
      },
      {
        "bssid": "10:6f:3f:XX:XX:XX",
        "frequency_mhz": 2447,
        "rssi": -78,
        "ssid": "matohara",
        "timestamp": 2978153249
      }
    ]
    

Androidアプリケーションを作成しなくてもちょっとしたことならこのAPIの組み合わせで遊ぶことができそうです.(bash+Zenityみたいな?ちょっとちがうか)
Termux:Task/Boot等と組み合わせると更に活用の幅は広がりそうです.(未確認)

Android端末にTermux + Dropbearでssh login

TermuxはAndroid上でLinux環境が構築できる独自パッケージシステムなアプリケーションです.端末ソフトも同梱されています.Termux-apiを使うとshellでAndroidの操作が出来てちょっと面白いのですが,Androidのタッチパネルで文字を打つのが面倒.リモート操作したいのでsshdが動かないか試してみました.

パッケージを検索してみます.定番のOpenSSHとDropbearが使えそうです.

$ pkg search ssh
Hit:1 https://termux.net stable InRelease
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.
Sorting... Done
Full Text Search... Done
autossh/stable 1.4f arm
  Automatically restart SSH sessions and tunnels

corkscrew/stable 2.0-1 arm
  A tool for tunneling SSH through HTTP proxies

dropbear/stable,now 2018.76-1 arm [installed]
  Small SSH server and client

libssh/stable 0.7.5-1 arm
  Tiny C SSH library

libssh-dev/stable 0.7.5-1 arm
  Development files for libssh

openssh/stable 7.7p1-2 arm
  Secure shell for logging into a remote machine

sshpass/stable 1.06 arm
  Noninteractive ssh password provider

今回は操作ができればいいので消費リソースの少ないDropbearを選択しました.

$ pkg install dropbear
$ dropbear -h
Dropbear server v2018.76 https://matt.ucc.asn.au/dropbear/dropbear.html
Usage: dropbear [options]
-b bannerfile   Display the contents of bannerfile before user login
                (default: none)
-r keyfile  Specify hostkeys (repeatable)
                defaults: 
                dss /data/data/com.termux/files/usr/etc/dropbear/dropbear_dss_host_key
                rsa /data/data/com.termux/files/usr/etc/dropbear/dropbear_rsa_host_key
                ecdsa /data/data/com.termux/files/usr/etc/dropbear/dropbear_ecdsa_host_key
-R              Create hostkeys as required
-F              Don't fork into background
(Syslog support not compiled in, using stderr)
-w              Disallow root logins
-G              Restrict logins to members of specified group
-T              Maximum authentication tries (default 10)
-j              Disable local port forwarding
-k              Disable remote port forwarding
-a              Allow connections to forwarded ports from any host
-c command      Force executed command
-p [address:]port
                Listen on specified tcp port (and optionally address),
                up to 10 can be specified
                (default port is 8022 if none specified)
-P PidFile      Create pid file PidFile
                (default /data/data/com.termux/files/usr/var/run/dropbear.pid)
-i              Start for inetd
-W <receive_window_buffer> (default 24576, larger may be faster, max 1MB)
-K <keepalive>  (0 is never, default 0, in seconds)
-I <idle_timeout>  (0 is never, default 0, in seconds)
-V    Version

鍵を用意します.普通に~/.ssh/authorized_keysに公開鍵を登録すれば良いようです.PCで作成した鍵ペアの公開鍵を登録しました.

$ cd && pwd
/data/data/com.termux/files/home
$ ls -lA ~/.ssh
total 4
-rw-------    1 u0_a235  u0_a235        170 Jun 20 03:58 authorized_keys

sshデーモンを起動します.オプションは適当でポート番号を2222番にしています.

$ dropbear -w -T 2 -j -k -p 2222 -I 600

Androidのipアドレスを確認して,

$ ip r
default via 192.168.2.1 dev wlan0  metric 322 
100.93.0.128/26 dev rmnet0  proto kernel  scope link  src 100.93.0.160 
192.168.2.0/24 dev wlan0  proto kernel  scope link  src 192.168.2.211  metric 322

PCからこんな感じで接続してみると繋がりました!

$ ssh u0_a235@192.168.2.211 -p 2222 -i ~/.ssh/id_ed25519_termux

これで操作が楽に&端末の結果を保存しやすくなりました.

追記)
Dropbearを止める

$ pgrep dropbear
10925
10958
$ pkill dropbear