rt-net / RaspberryPiMouse

Raspberry Pi Mouse Device Driver
Other
60 stars 455 forks source link

デバイスドライバのUbuntu Server 24.04への対応 #84

Closed KuraZuzu closed 1 month ago

KuraZuzu commented 1 month ago

What does this implement/fix?

Ubuntu Server 24.04上でデバイスドライバをビルドして動作するように修正しました。

Does this close any currently open issues?

https://github.com/rt-net/RaspberryPiMouse/issues/81 をクローズします。

How has this been tested?

以下の手順にしたがってビルドとサンプルプログラムの動作確認をしました。

環境

手順

以下の手順で動作確認まで行います。環境により、操作が違います。

Ubuntu Server 24.04

  1. sudo apt update && sudo apt upgradeを実行します

  2. /boot/firmware/config.txtを編集し、ファイル末尾に以下の記述を追加します

    dtoverlay=anyspi:spi0-0,dev="microchip,mcp3204",speed=1000000
    dtparam=i2c_baudrate=62500
  3. Raspberry Pi を再起動します

  4. 以下のコマンドを実行し、出力が62500になっていることを確認します

$ printf "%d\n" 0x$(xxd -ps /sys/class/i2c-adapter/i2c-1/of_node/clock-frequency)
62500
  1. ラズパイマウスのデバイスドライバのコードをcloneし、本開発リポジトリにチェックアウトした後にインストールします
$ git clone -b spi-overlay https://github.com/rt-net/RaspberryPiMouse.git
$ cd RaspberryPiMouse/utils
$ sudo apt install linux-headers-$(uname -r) build-essential
$ ./build_install.bash
  1. step1.shからstep6.shのサンプルプログラムの動作を確認します(この手順は、ラズパイマウスのマニュアルの通りです)
    $ cd ../SampleProgram
    $ bash step1.sh
    $ bash step2.sh
    .
    .
    .
    $ bash step6.sh

Ubuntu Server 22.04

  1. sudo apt update && sudo apt upgradeを実行します

  2. /boot/firmware/config.txtを編集し、ファイル末尾に以下の記述を追加します

Ubuntu`dtparam=i2c_baudrate=62500`
  1. Raspberry Pi を再起動します

  2. ラズパイマウスのデバイスドライバのコードをcloneし、本開発リポジトリにチェックアウトした後にインストールします

    $ git clone -b spi-overlay https://github.com/rt-net/RaspberryPiMouse.git
    $ cd RaspberryPiMouse/utils
    $ sudo apt install linux-headers-$(uname -r) build-essential
    $ ./build_install.bash
  3. step1.shからstep6.shのサンプルプログラムの動作を確認します(この手順は、ラズパイマウスのマニュアルの通りです)

    $ cd ../SampleProgram
    $ bash step1.sh
    $ bash step2.sh
    .
    .
    .
    $ bash step6.sh

Raspberry Pi OS(32-bit, 64-bitで共通)

モニタとマウスをRaspberry Piに接続し、GUI上で操作します。

  1. 起動したら、GUIからSPIとI2Cを有効化します

画像の通り、[画面左上のロゴマーク] -> [Preferences] -> [Raspberry Pi Configuration] とクリックしたら出てくるウィジェットから、SPII2CのトグルをONにします。

これ以降は、ターミナルを開いて操作します。

activate_spi_and_i2c

  1. sudo apt updateを実行します

  2. /boot/firmware/config.txtを編集し、ファイル末尾に以下の記述を追加します

arm_64bit=0の記述は、64-bit版では不要です。

arm_64bit=0  # 64-bit版では不要です
dtoverlay=anyspi:spi0-0,dev="microchip,mcp3204",speed=1000000
dtparam=i2c_baudrate=62500
  1. Raspberry Pi を再起動します

  2. 以下のコマンドを実行し、出力が62500になっていることを確認します(同時にxxdのインストールも行います)

$ sudo apt install xxd
$ printf "%d\n" 0x$(xxd -ps /sys/class/i2c-adapter/i2c-1/of_node/clock-frequency)
62500
  1. ラズパイマウスのデバイスドライバのコードをcloneし、本開発リポジトリにチェックアウトした後にインストールします
$ git clone -b spi-overlay https://github.com/rt-net/RaspberryPiMouse.git
$ cd RaspberryPiMouse/utils
$ sudo apt install linux-headers-$(uname -r) build-essential
$ ./build_install.bash
  1. step1.shからstep6.shのサンプルプログラムの動作を確認します(この手順は、ラズパイマウスのマニュアルの通りです)
    $ cd ../SampleProgram
    $ bash step1.sh
    $ bash step2.sh
    .
    .
    .
    $ bash step6.sh

Any other comments?

Checklists

ShotaAk commented 1 month ago

LGTMです