11# RaspberryPiMouse
22
3- ![ CI] ( https://github.com/rt-net/RaspberryPiMouse/workflows/CI /badge.svg?branch=master )
3+ [ ![ CI] ( https://github.com/rt-net/RaspberryPiMouse/actions/ workflows/driver-cross-build.yml /badge.svg )] ( https://github.com/rt-net/RaspberryPiMouse/actions/workflows/driver-cross-build.yml )
44
55This repository has the source code and kernel objects
66for the Raspberry Pi Mouse.
77
88## Installation
99
10- Run the installation script ( [ ` ./utils/build_install.bash ` ] ( https://github.com/rt-net/RaspberryPiMouse/blob/master/utils/build_install.bash ) ) .
10+ Run the following scripts .
1111
12- インストール用のシェルスクリプト([ ` ./utils/build_install.bash ` ] ( https://github.com/rt-net/RaspberryPiMouse/blob/master/utils/build_install.bash ) )を実行します。
12+ - setting script ([ ` ./utils/set_configs.bash ` ] ( https://github.com/rt-net/RaspberryPiMouse/blob/master/utils/set_configs.bash ) )
13+ - installation script ([ ` ./utils/build_install.bash ` ] ( https://github.com/rt-net/RaspberryPiMouse/blob/master/utils/build_install.bash ) )
1314
14- ### for Raspberry Pi OS
15-
16- ` /boot/firmware/config.txt ` を編集し、ファイル末尾に以下の設定を追加します。
17-
18- ``` sh
19- arm_64bit=0 # "64-bit"版では不要です
20- dtoverlay=anyspi:spi0-0,dev=" microchip,mcp3204" ,speed=1000000 # カーネル5.16未満の場合は不要です
21- dtparam=i2c_baudrate=62500
22- ```
15+ 以下のスクリプトを実行します
16+ - setting script([ ` ./utils/set_configs.bash ` ] ( https://github.com/rt-net/RaspberryPiMouse/blob/master/utils/set_configs.bash ) )
17+ - installation script([ ` ./utils/build_install.bash ` ] ( https://github.com/rt-net/RaspberryPiMouse/blob/master/utils/build_install.bash ) )
2318
24- Raspberry Piを再起動します。
19+ ### for ` Raspberry Pi OS ` ・ ` Ubuntu `
2520
26- 以下のコマンドでインストールを実行します 。
21+ 以下のコマンドで本リポジトリをダウンロードし、Raspberry Pi本体の設定を行います 。
2722
28- ``` sh
23+ ``` bash
2924$ git clone https://github.com/rt-net/RaspberryPiMouse.git
3025$ cd RaspberryPiMouse/utils
31- $ sudo apt install raspberrypi-kernel-headers build-essential
32- $ ./build_install.bash
26+ $ ./set_configs.bash
3327```
3428
35- ### for Ubuntu
29+ Raspberry Piを再起動し、以下のコマンドを実行してビルドに必要なファイルをインストールします。 ** ` Ubuntu ` と ` Raspberry Pi OS ` でコマンドが違います。 **
3630
37- ` /boot/firmware/config.txt ` を編集し、ファイル末尾に以下の設定を追加します。
31+ ``` bash
32+ # Ubuntu Serverの場合
33+ $ sudo apt install linux-headers-$( uname -r) build-essential
3834
39- ``` sh
40- dtoverlay=anyspi:spi0-0,dev=" microchip,mcp3204" ,speed=1000000 # "Ubuntu Server 22.04"では不要です
41- dtparam=i2c_baudrate=62500
35+ # Raspberry Pi OSの場合
36+ $ sudo apt install raspberrypi-kernel-headers build-essential
4237```
4338
44- Raspberry Piを再起動します 。
39+ 以下のコマンドでビルドを実行します 。
4540
46- 以下のコマンドでインストールを実行します。
47-
48- ``` sh
49- $ git clone https://github.com/rt-net/RaspberryPiMouse.git
41+ ``` bash
5042$ cd RaspberryPiMouse/utils
51- $ sudo apt install linux-headers-$( uname -r) build-essential
5243$ ./build_install.bash
5344```
5445
5546### Manual installation
5647
57- ``` sh
48+ ``` bash
5849$ git clone https://github.com/rt-net/RaspberryPiMouse.git
5950$ cd RaspberryPiMouse/src/drivers
6051$ make
@@ -63,23 +54,31 @@ $ sudo insmod rtmouse.ko
6354
6455## Notes for the installation (ドライバの導入の際の注意)
6556
57+ 特定の機能の有効化や、プログラムのビルドのために設定が必要な項目があります。以下の設定をご確認ください。
58+
59+ ※[ ` ./utils/set_configs.bash ` ] ( https://github.com/rt-net/RaspberryPiMouse/blob/master/utils/set_configs.bash ) を実行すると、[ 自動で適切な設定に書き換わります] ( (https://github.com/rt-net/RaspberryPiMouse/blob/master/utils/set_configs.bash) ) 。
60+
61+
6662### for Raspberry Pi OS
6763
64+ Raspberry Pi OSでは、SPIとI2Cがデフォルトで無効となっているため、有効化する必要があります。
65+
66+ #### for SPI and I2C
67+
6868Enable SPI and I2C functions via ` raspi-config ` command.
6969
70- 以下の設定を確認ください。
7170` raspi-config ` コマンドで設定します。
7271
7372* SPI機能を「入」にする。
7473* I2C機能を「入」にする。
7574
76-
7775### for Raspberry Pi 4
7876
79- Edit [ ` rtmouse.c ` ] ( https://github.com/rt-net/RaspberryPiMouse/blob/dd0343449951a99b067e24aef3c03ae5ed9ab936/src/drivers/rtmouse.c#L54 ) to change the defined value ` RASPBERRYPI ` from '2' to '4' .
77+ Edit [ ` rtmouse.c ` ] ( https://github.com/rt-net/RaspberryPiMouse/blob/dd0343449951a99b067e24aef3c03ae5ed9ab936/src/drivers/rtmouse.c#L54 ) to change the defined value ` RASPBERRYPI ` from` 2 ` to ` 4 ` .
8078
8179Raspberry Pi 4ではCPUのレジスタがそれまでのRaspberry Piとは異なります([ issues #21 ] ( https://github.com/rt-net/RaspberryPiMouse/issues/21 ) )。
8280Raspberry Pi 4で本ドライバを使用する際には` rtmouse.c ` の以下の行(2020年4月13日現在の最新版のv2.1.0では[ 54行目] ( https://github.com/rt-net/RaspberryPiMouse/blob/dd0343449951a99b067e24aef3c03ae5ed9ab936/src/drivers/rtmouse.c#L54 ) )を` RASPBERRYPI 4 ` に書き換えてビルドする必要があります。
81+
8382※[ ` ./utils/build_install.bash ` ] ( ./utils/build_install.bash ) を実行すると、Raspberry Piのモデルに合わせて[ ` rtmouse.c ` ] ( ./src/drivers/rtmouse.c ) が[ 自動で書き換わります] ( https://github.com/rt-net/RaspberryPiMouse/blob/a9af4fa2b2a8e34c0f93a6ce5cf88ebd50ff39c2/utils/build_install.raspi4ubuntu.bash#L13-L14 ) 。
8483
8584``` c
@@ -91,6 +90,24 @@ Raspberry Pi 4で本ドライバを使用する際には`rtmouse.c`の以下の
9190#define RASPBERRYPI 2
9291```
9392
93+ ### for 32-bit OS
94+
95+ Set 32bit-setting to `/boot/firmware/config.txt`.
96+
97+ 32-bit版のOSではビルドするために、`/boot/firmware/config.txt`に以下の1行を追加する必要があります。
98+
99+ ```bash
100+ arm_64bit=0
101+ ```
102+
103+ ### デバイスツリーオーバーレイについて
104+
105+ kernel `5.16 `以降では`/boot/firmware/config.txt`に以下の設定を記述し、dtoverlayを設定する必要があります。※[`./utils/set_configs.bash`](https:// github.com/rt-net/RaspberryPiMouse/blob/master/utils/set_configs.bash)を実行すると、設定は[自動で書き換わります]((https://github.com/rt-net/RaspberryPiMouse/blob/master/utils/set_configs.bash#L35-#L49))。
106+
107+ ```bash
108+ dtoverlay=anyspi:spi0-0 ,dev=" microchip,mcp3204" ,speed=1000000
109+ ```
110+
94111### パルスカウンタについて
95112
96113パルスカウンタは値の読み取りにI2Cを使用しています。仕様上は400kHzまでbaudrateを上げることができます(※1)。
@@ -102,9 +119,11 @@ it may be necessary to set the I2C baudrate lower than the default value.
102119Add a following new line in ` /boot/firmware/config.txt ` to change the i2c_baudrate to 62.5 kHz.
103120
104121` /boot/firmware/config.txt ` に以下の1行を追加することでI2Cのbaudrateを62.5kHzに固定することができます。
105- ```
122+
123+ ``` bash
106124dtparam=i2c_baudrate=62500
107125```
126+
108127※1 Raspberry Pi 4 Model B(Ubuntu Server ` 18.04 ` / ` 20.04 ` / ` 22.04 ` / ` 24.04 ` )を搭載して400kHzで通信できることを確認しています。
109128※2 現在設定されているI2Cのbaudrateは以下のコマンドを実行することで確認できます。
110129```
0 commit comments