0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Ubuntuからシリアルポート接続を試してみた

Last updated at Posted at 2025-04-10

勉強のためにIX2215を購入しました。

いつもWindowsからTeraTerm経由で接続していますが、今回は気分を変えてUbuntuから接続してみることに。
Linuxはほとんど使ったことがないので備忘がてらメモします。

ルーターからPCまではコンソールケーブルとUSBシリアル変換ケーブルを使います。

LinuxではUSBポートを/dev/tty*のファイルとして認識するみたいです。
今回はこんな感じ。

ls /dev/tty*
 /ttyUSB0 ※ほかにもいっぱい出てきた

接続方法は色々あるみたいですが調べて出てきたcuを試します。
dialoutというグループに参加させる必要があるみたいです。(要確認)

sudo usermod -aG dialout USER

ちゃんと入っているか確認。

groups USER
 
 USER : USER dialout sudo
getent group dialout
 
 dialout:x:20:USER

実行してみましたがパーミッションエラーが...

cu -l ttyUSB0

 cu: open (/dev/ttyUSB0): Permission denied
 cu: ttyUSB0: Lini in use

/dev/ttyUSB0の権限を変えるとうまくいくという情報があったので試すと成功しました。
cuの使用についてはまた勉強しておきます。

chmod 666 /dev/ttyUSB0
cu -l ttyUSB0

 Connected

切断時は~.で行けるみたいです。
~を入力すると[USER]が出てきたので.で切断できました。

Router#~[USER].
  
  Disconnected.

ひとまずつながって設定はできそうですが、コマンド周りが怪しいのでもう少し勉強してみます。
cuの引数もデフォルトのままつながっちゃったけど大丈夫なんだろうか。
screenとかほかのコマンドもいつか試してみます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?