1
1
# RaspberryPiMouse
2
2
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 )
4
4
5
5
This repository has the source code and kernel objects
6
6
for the Raspberry Pi Mouse.
7
7
8
8
## Installation
9
9
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 .
11
11
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 ) )
13
14
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 ) )
23
18
24
- Raspberry Piを再起動します。
19
+ ### for ` Raspberry Pi OS ` ・ ` Ubuntu `
25
20
26
- 以下のコマンドでインストールを実行します 。
21
+ 以下のコマンドで本リポジトリをダウンロードし、Raspberry Pi本体の設定を行います 。
27
22
28
- ``` sh
23
+ ``` bash
29
24
$ git clone https://github.com/rt-net/RaspberryPiMouse.git
30
25
$ cd RaspberryPiMouse/utils
31
- $ sudo apt install raspberrypi-kernel-headers build-essential
32
- $ ./build_install.bash
26
+ $ ./set_configs.bash
33
27
```
34
28
35
- ### for Ubuntu
29
+ Raspberry Piを再起動し、以下のコマンドを実行してビルドに必要なファイルをインストールします。 ** ` Ubuntu ` と ` Raspberry Pi OS ` でコマンドが違います。 **
36
30
37
- ` /boot/firmware/config.txt ` を編集し、ファイル末尾に以下の設定を追加します。
31
+ ``` bash
32
+ # Ubuntu Serverの場合
33
+ $ sudo apt install linux-headers-$( uname -r) build-essential
38
34
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
42
37
```
43
38
44
- Raspberry Piを再起動します 。
39
+ 以下のコマンドでビルドを実行します 。
45
40
46
- 以下のコマンドでインストールを実行します。
47
-
48
- ``` sh
49
- $ git clone https://github.com/rt-net/RaspberryPiMouse.git
41
+ ``` bash
50
42
$ cd RaspberryPiMouse/utils
51
- $ sudo apt install linux-headers-$( uname -r) build-essential
52
43
$ ./build_install.bash
53
44
```
54
45
55
46
### Manual installation
56
47
57
- ``` sh
48
+ ``` bash
58
49
$ git clone https://github.com/rt-net/RaspberryPiMouse.git
59
50
$ cd RaspberryPiMouse/src/drivers
60
51
$ make
@@ -63,23 +54,31 @@ $ sudo insmod rtmouse.ko
63
54
64
55
## Notes for the installation (ドライバの導入の際の注意)
65
56
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
+
66
62
### for Raspberry Pi OS
67
63
64
+ Raspberry Pi OSでは、SPIとI2Cがデフォルトで無効となっているため、有効化する必要があります。
65
+
66
+ #### for SPI and I2C
67
+
68
68
Enable SPI and I2C functions via ` raspi-config ` command.
69
69
70
- 以下の設定を確認ください。
71
70
` raspi-config ` コマンドで設定します。
72
71
73
72
* SPI機能を「入」にする。
74
73
* I2C機能を「入」にする。
75
74
76
-
77
75
### for Raspberry Pi 4
78
76
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 ` .
80
78
81
79
Raspberry Pi 4ではCPUのレジスタがそれまでのRaspberry Piとは異なります([ issues #21 ] ( https://github.com/rt-net/RaspberryPiMouse/issues/21 ) )。
82
80
Raspberry 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
+
83
82
※[ ` ./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 ) 。
84
83
85
84
``` c
@@ -91,6 +90,24 @@ Raspberry Pi 4で本ドライバを使用する際には`rtmouse.c`の以下の
91
90
#define RASPBERRYPI 2
92
91
```
93
92
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
+
94
111
### パルスカウンタについて
95
112
96
113
パルスカウンタは値の読み取りにI2Cを使用しています。仕様上は400kHzまでbaudrateを上げることができます(※1)。
@@ -102,9 +119,11 @@ it may be necessary to set the I2C baudrate lower than the default value.
102
119
Add a following new line in ` /boot/firmware/config.txt ` to change the i2c_baudrate to 62.5 kHz.
103
120
104
121
` /boot/firmware/config.txt ` に以下の1行を追加することでI2Cのbaudrateを62.5kHzに固定することができます。
105
- ```
122
+
123
+ ``` bash
106
124
dtparam=i2c_baudrate=62500
107
125
```
126
+
108
127
※1 Raspberry Pi 4 Model B(Ubuntu Server ` 18.04 ` / ` 20.04 ` / ` 22.04 ` / ` 24.04 ` )を搭載して400kHzで通信できることを確認しています。
109
128
※2 現在設定されているI2Cのbaudrateは以下のコマンドを実行することで確認できます。
110
129
```
0 commit comments