From df3aec5605619e6829f15c1c101d50f260b19229 Mon Sep 17 00:00:00 2001 From: kurasawa Date: Thu, 5 Sep 2024 11:07:43 +0900 Subject: [PATCH 01/20] =?UTF-8?q?/boot/firmware/confit.txt=E3=81=ABdtoverl?= =?UTF-8?q?ay=E3=81=A8dtparam=E3=82=92=E8=BF=BD=E8=A8=98=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=82=B9=E3=82=AF=E3=83=AA=E3=83=97=E3=83=88=E3=82=92=E4=BD=9C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/set_configs.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 utils/set_configs.sh diff --git a/utils/set_configs.sh b/utils/set_configs.sh new file mode 100755 index 0000000..bfdb734 --- /dev/null +++ b/utils/set_configs.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +set -eu + +# dtoverlay-setting +DTOVERLAY='dtoverlay=anyspi:spi0-0,dev="microchip,mcp3204",speed=1000000' +DTPARAM='dtparam=i2c_baudrate=62500' + +# config-file PATH +CONFIG_FILE='/boot/firmware/config.txt' + +# add dtoverlay-setting for "/boot/firmware/config.txt" +if ! grep -qxF "$DTOVERLAY" "$CONFIG_FILE"; then + echo "$DTOVERLAY" | sudo tee -a "$CONFIG_FILE" >> /dev/null + echo "Add \"$DTOVERLAY\" > $CONFIG_FILE" +fi + +# add dtparam-setting for "/boot/firmware/config.txt" +if ! grep -qxF "$DTPARAM" "$CONFIG_FILE"; then + echo "$DTPARAM" | sudo tee -a "$CONFIG_FILE" >> /dev/null + echo "Add \"$DTPARAM\" > $CONFIG_FILE" +fi From 4625ff3c4d04d665e2c58fa83829dcd45ac3e8e3 Mon Sep 17 00:00:00 2001 From: kurasawa Date: Thu, 5 Sep 2024 11:31:15 +0900 Subject: [PATCH 02/20] =?UTF-8?q?=E3=82=AB=E3=83=BC=E3=83=8D=E3=83=AB?= =?UTF-8?q?=E3=81=AE=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3=E3=81=AB?= =?UTF-8?q?=E5=BF=9C=E3=81=98=E3=81=A6dtoverlay=E3=81=AE=E8=A8=AD=E5=AE=9A?= =?UTF-8?q?=E3=82=92=E6=8C=BF=E5=85=A5=E3=81=99=E3=82=8B=E3=81=8B=E3=81=AE?= =?UTF-8?q?=E5=88=86=E5=B2=90=E6=9D=A1=E4=BB=B6=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/set_configs.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/utils/set_configs.sh b/utils/set_configs.sh index bfdb734..d0bd240 100755 --- a/utils/set_configs.sh +++ b/utils/set_configs.sh @@ -8,14 +8,21 @@ DTPARAM='dtparam=i2c_baudrate=62500' # config-file PATH CONFIG_FILE='/boot/firmware/config.txt' -# add dtoverlay-setting for "/boot/firmware/config.txt" -if ! grep -qxF "$DTOVERLAY" "$CONFIG_FILE"; then - echo "$DTOVERLAY" | sudo tee -a "$CONFIG_FILE" >> /dev/null - echo "Add \"$DTOVERLAY\" > $CONFIG_FILE" -fi +# kernel version +KERNEL_VERSION=$(uname -r | cut -d'.' -f1,2) # add dtparam-setting for "/boot/firmware/config.txt" if ! grep -qxF "$DTPARAM" "$CONFIG_FILE"; then echo "$DTPARAM" | sudo tee -a "$CONFIG_FILE" >> /dev/null echo "Add \"$DTPARAM\" > $CONFIG_FILE" fi + +# use device-tree-overlay when the kernel is 5.16 or higher +if (( $(echo "$KERNEL_VERSION >= 5.16" | bc -l) )); then + + # add dtoverlay-setting for "/boot/firmware/config.txt" + if ! grep -qxF "$DTOVERLAY" "$CONFIG_FILE"; then + echo "$DTOVERLAY" | sudo tee -a "$CONFIG_FILE" >> /dev/null + echo "Add \"$DTOVERLAY\" > $CONFIG_FILE" + fi +fi \ No newline at end of file From b561e6052103acad77b982ed2e1eb9f94884c582 Mon Sep 17 00:00:00 2001 From: kurasawa Date: Thu, 5 Sep 2024 12:42:18 +0900 Subject: [PATCH 03/20] =?UTF-8?q?spi=E3=81=A8i2c=E3=82=92on=E3=81=AB?= =?UTF-8?q?=E3=81=99=E3=82=8B=E5=87=A6=E7=90=86=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/set_configs.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/utils/set_configs.sh b/utils/set_configs.sh index d0bd240..c1ce243 100755 --- a/utils/set_configs.sh +++ b/utils/set_configs.sh @@ -25,4 +25,16 @@ if (( $(echo "$KERNEL_VERSION >= 5.16" | bc -l) )); then echo "$DTOVERLAY" | sudo tee -a "$CONFIG_FILE" >> /dev/null echo "Add \"$DTOVERLAY\" > $CONFIG_FILE" fi +fi + +# replace "dtparam=i2c_arm=off" with "dtparam=i2c_arm=on" +if grep -qxF 'dtparam=i2c_arm=off' "$CONFIG_FILE"; then + sudo sed -i 's/dtparam=i2c_arm=off/dtparam=i2c_arm=on/' "$CONFIG_FILE" + echo "changed \"dtparam=i2c_arm=off\" to \"dtparam=i2c_arm=on\" in $CONFIG_FILE" +fi + +# replace "dtparam=spi=off" with "dtparam=spi=on" +if grep -qxF 'dtparam=spi=off' "$CONFIG_FILE"; then + sudo sed -i 's/dtparam=spi=off/dtparam=spi=on/' "$CONFIG_FILE" + echo "changed \"dtparam=spi=off\" to \"dtparam=spi=on\" in $CONFIG_FILE" fi \ No newline at end of file From d5aa88a17b3ffd53116de051c0f1dc52831c7da3 Mon Sep 17 00:00:00 2001 From: kurasawa Date: Thu, 5 Sep 2024 12:57:00 +0900 Subject: [PATCH 04/20] =?UTF-8?q?OS=E3=81=8C32bit=E7=89=88=E3=81=A7?= =?UTF-8?q?=E3=81=82=E3=82=8C=E3=81=B0"arm=5F64bit=3D0"=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E8=A8=98=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E5=A4=89?= =?UTF-8?q?=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/set_configs.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/utils/set_configs.sh b/utils/set_configs.sh index c1ce243..0fef5e3 100755 --- a/utils/set_configs.sh +++ b/utils/set_configs.sh @@ -1,8 +1,13 @@ #!/usr/bin/env bash set -eu -# dtoverlay-setting +# OS architecture (32-bit or 64-bit) +ARCHITECTURE=$(uname -m) + +# dtoverlay setting DTOVERLAY='dtoverlay=anyspi:spi0-0,dev="microchip,mcp3204",speed=1000000' + +# i2c_baudrate setting DTPARAM='dtparam=i2c_baudrate=62500' # config-file PATH @@ -11,6 +16,13 @@ CONFIG_FILE='/boot/firmware/config.txt' # kernel version KERNEL_VERSION=$(uname -r | cut -d'.' -f1,2) +if [[ "$ARCHITECTURE" == "armv7l" ]]; then + if ! grep -qxF "arm_64bit=0" "$CONFIG_FILE"; then + echo "arm_64bit=0" | sudo tee -a "$CONFIG_FILE" + echo " Add \"arm_64bit=0\" > $CONFIG_FILE" + fi +fi + # add dtparam-setting for "/boot/firmware/config.txt" if ! grep -qxF "$DTPARAM" "$CONFIG_FILE"; then echo "$DTPARAM" | sudo tee -a "$CONFIG_FILE" >> /dev/null From 83c5af9b3f68dc342753bbd0b955cbbd9f71a6da Mon Sep 17 00:00:00 2001 From: kurasawa Date: Thu, 5 Sep 2024 13:14:54 +0900 Subject: [PATCH 05/20] =?UTF-8?q?Raspberry=20Pi=20Mouse=20V3=E3=81=AE?= =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E3=81=A7=E3=81=82=E3=82=8B=E6=97=A8=E3=81=AE?= =?UTF-8?q?=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88=E3=82=92=E8=BF=BD=E8=A8=98?= =?UTF-8?q?=E3=81=99=E3=82=8B=E5=87=A6=E7=90=86=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/set_configs.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/utils/set_configs.sh b/utils/set_configs.sh index 0fef5e3..cda23a9 100755 --- a/utils/set_configs.sh +++ b/utils/set_configs.sh @@ -1,13 +1,16 @@ #!/usr/bin/env bash set -eu +# settings comment +SETTING_COMMENT='# Raspberry Pi Mouse V3 settings' + # OS architecture (32-bit or 64-bit) ARCHITECTURE=$(uname -m) # dtoverlay setting DTOVERLAY='dtoverlay=anyspi:spi0-0,dev="microchip,mcp3204",speed=1000000' -# i2c_baudrate setting +# i2c_baudrate-setting DTPARAM='dtparam=i2c_baudrate=62500' # config-file PATH @@ -16,6 +19,12 @@ CONFIG_FILE='/boot/firmware/config.txt' # kernel version KERNEL_VERSION=$(uname -r | cut -d'.' -f1,2) + +# add Raspberry Pi Mouse V3 settings" +if ! grep -qxF "$SETTING_COMMENT" "$CONFIG_FILE"; then + echo "$SETTING_COMMENT" | sudo tee -a "$CONFIG_FILE" > /dev/null +fi + if [[ "$ARCHITECTURE" == "armv7l" ]]; then if ! grep -qxF "arm_64bit=0" "$CONFIG_FILE"; then echo "arm_64bit=0" | sudo tee -a "$CONFIG_FILE" From de06624e61c4bc4892610bcbc00f9924f1ca4674 Mon Sep 17 00:00:00 2001 From: kurasawa Date: Mon, 9 Sep 2024 11:49:02 +0900 Subject: [PATCH 06/20] =?UTF-8?q?README=E3=82=92=E6=95=B4=E5=82=99?= =?UTF-8?q?=E3=81=97=E3=80=81=E8=A8=AD=E5=AE=9A=E3=82=B9=E3=82=AF=E3=83=AA?= =?UTF-8?q?=E3=83=97=E3=83=88=E3=82=92sh=E3=81=8B=E3=82=89bash=E3=81=AB?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 74 ++++++++++++---------- utils/{set_configs.sh => set_configs.bash} | 0 2 files changed, 41 insertions(+), 33 deletions(-) rename utils/{set_configs.sh => set_configs.bash} (100%) diff --git a/README.md b/README.md index bb78fd5..3b11fe8 100644 --- a/README.md +++ b/README.md @@ -7,54 +7,36 @@ for the Raspberry Pi Mouse. ## Installation -Run the installation script ([`./utils/build_install.bash`](https://github.com/rt-net/RaspberryPiMouse/blob/master/utils/build_install.bash)). +Run the following scripts. -インストール用のシェルスクリプト([`./utils/build_install.bash`](https://github.com/rt-net/RaspberryPiMouse/blob/master/utils/build_install.bash))を実行します。 +- setting script ([`./utils/set_configs.bash`](https://github.com/rt-net/RaspberryPiMouse/blob/master/utils/set_configs.bash)) +- installation script ([`./utils/build_install.bash`](https://github.com/rt-net/RaspberryPiMouse/blob/master/utils/build_install.bash)) -### for Raspberry Pi OS - -`/boot/firmware/config.txt`を編集し、ファイル末尾に以下の設定を追加します。 +以下のスクリプトを実行します +- setting script([`./utils/set_configs.bash`](https://github.com/rt-net/RaspberryPiMouse/blob/master/utils/set_configs.bash)) +- installation script([`./utils/build_install.bash`](https://github.com/rt-net/RaspberryPiMouse/blob/master/utils/build_install.bash)) -```sh -arm_64bit=0 # "64-bit"版では不要です -dtoverlay=anyspi:spi0-0,dev="microchip,mcp3204",speed=1000000 # カーネル5.16未満の場合は不要です -dtparam=i2c_baudrate=62500 -``` - -Raspberry Piを再起動します。 +### for `Raspberry Pi OS`・`Ubuntu` 以下のコマンドでインストールを実行します。 -```sh +```bash $ git clone https://github.com/rt-net/RaspberryPiMouse.git $ cd RaspberryPiMouse/utils -$ sudo apt install raspberrypi-kernel-headers build-essential -$ ./build_install.bash +$ ./set_configs.bash ``` -### for Ubuntu +PCを再起動した後、以下のコマンドを実行します。 -`/boot/firmware/config.txt`を編集し、ファイル末尾に以下の設定を追加します。 - -```sh -dtoverlay=anyspi:spi0-0,dev="microchip,mcp3204",speed=1000000 # "Ubuntu Server 22.04"では不要です -dtparam=i2c_baudrate=62500 -``` - -Raspberry Piを再起動します。 - -以下のコマンドでインストールを実行します。 - -```sh -$ git clone https://github.com/rt-net/RaspberryPiMouse.git +```bash +$ sudo apt install raspberrypi-kernel-headers build-essential $ cd RaspberryPiMouse/utils -$ sudo apt install linux-headers-$(uname -r) build-essential $ ./build_install.bash ``` ### Manual installation -```sh +```bash $ git clone https://github.com/rt-net/RaspberryPiMouse.git $ cd RaspberryPiMouse/src/drivers $ make @@ -65,14 +47,28 @@ $ sudo insmod rtmouse.ko ### for Raspberry Pi OS +以下の設定を確認ください。※[`./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#L51-#L61))。 + +#### for SPI and I2C + Enable SPI and I2C functions via `raspi-config` command. -以下の設定を確認ください。 `raspi-config` コマンドで設定します。 * SPI機能を「入」にする。 * I2C機能を「入」にする。 +#### for 32-bit OS + +Set 32bit-setting to `/boot/firmware/config.txt`. + +`/boot/firmware/config.txt`を編集し、ファイル末尾に以下の記述を追加します。 + +```bash +$ sudo nano /boot/firmware/config.txt + +arm_64bit=0 +``` ### for Raspberry Pi 4 @@ -91,6 +87,16 @@ Raspberry Pi 4で本ドライバを使用する際には`rtmouse.c`の以下の #define RASPBERRYPI 2 ``` +### デバイスツリーオーバーレイについて + +kernel `5.16`以降では`/boot/firmware/config.txt`で以下の設定を記述する必要があります。※[`./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))。 + +```bash +$ sudo nano /boot/firmware/config.txt + +dtoverlay=anyspi:spi0-0,dev="microchip,mcp3204",speed=1000000 +``` + ### パルスカウンタについて パルスカウンタは値の読み取りにI2Cを使用しています。仕様上は400kHzまでbaudrateを上げることができます(※1)。 @@ -102,9 +108,11 @@ it may be necessary to set the I2C baudrate lower than the default value. Add a following new line in `/boot/firmware/config.txt` to change the i2c_baudrate to 62.5 kHz. `/boot/firmware/config.txt`に以下の1行を追加することでI2Cのbaudrateを62.5kHzに固定することができます。 -``` + +```bash dtparam=i2c_baudrate=62500 ``` + ※1 Raspberry Pi 4 Model B(Ubuntu Server `18.04` / `20.04` / `22.04` / `24.04`)を搭載して400kHzで通信できることを確認しています。 ※2 現在設定されているI2Cのbaudrateは以下のコマンドを実行することで確認できます。 ``` diff --git a/utils/set_configs.sh b/utils/set_configs.bash similarity index 100% rename from utils/set_configs.sh rename to utils/set_configs.bash From 8035705661dfd7a3eecd524479f5288bf2b60d34 Mon Sep 17 00:00:00 2001 From: kurasawa Date: Mon, 9 Sep 2024 12:26:22 +0900 Subject: [PATCH 07/20] =?UTF-8?q?config.txt=E3=81=AB=E8=BF=BD=E8=A8=98?= =?UTF-8?q?=E3=81=99=E3=82=8B=E6=89=8B=E9=A0=86=E3=81=AE=E8=AA=AC=E6=98=8E?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E3=82=92=E4=BB=A5=E5=89=8D=E3=81=8B=E3=82=89?= =?UTF-8?q?=E3=81=82=E3=82=8B=E3=82=82=E3=81=AE=E3=81=AB=E7=B5=B1=E4=B8=80?= =?UTF-8?q?=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3b11fe8..3a0c27c 100644 --- a/README.md +++ b/README.md @@ -62,11 +62,9 @@ Enable SPI and I2C functions via `raspi-config` command. Set 32bit-setting to `/boot/firmware/config.txt`. -`/boot/firmware/config.txt`を編集し、ファイル末尾に以下の記述を追加します。 +32-bit版のOSではビルドするために、`/boot/firmware/config.txt`に以下の1行を追加する必要があります。 ```bash -$ sudo nano /boot/firmware/config.txt - arm_64bit=0 ``` @@ -89,11 +87,9 @@ Raspberry Pi 4で本ドライバを使用する際には`rtmouse.c`の以下の ### デバイスツリーオーバーレイについて -kernel `5.16`以降では`/boot/firmware/config.txt`で以下の設定を記述する必要があります。※[`./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))。 +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))。 ```bash -$ sudo nano /boot/firmware/config.txt - dtoverlay=anyspi:spi0-0,dev="microchip,mcp3204",speed=1000000 ``` From 2b082473dfb6eb1ca6216b1dcd9ee23dca31ad82 Mon Sep 17 00:00:00 2001 From: kurasawa Date: Wed, 11 Sep 2024 17:30:31 +0900 Subject: [PATCH 08/20] =?UTF-8?q?arm=5F64bit=3D0=E8=BF=BD=E8=A8=98?= =?UTF-8?q?=E6=99=82=E3=81=AE=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8?= =?UTF-8?q?=E6=A8=99=E6=BA=96=E5=87=BA=E5=8A=9B=E3=81=A7=E6=9C=80=E5=88=9D?= =?UTF-8?q?=E3=81=AB=E7=84=A1=E9=A7=84=E3=81=AA=E3=82=B9=E3=83=9A=E3=83=BC?= =?UTF-8?q?=E3=82=B9=E3=81=8C=E5=85=A5=E3=82=8B=E7=82=B9=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/set_configs.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/set_configs.bash b/utils/set_configs.bash index cda23a9..ffcd2a5 100755 --- a/utils/set_configs.bash +++ b/utils/set_configs.bash @@ -28,7 +28,7 @@ fi if [[ "$ARCHITECTURE" == "armv7l" ]]; then if ! grep -qxF "arm_64bit=0" "$CONFIG_FILE"; then echo "arm_64bit=0" | sudo tee -a "$CONFIG_FILE" - echo " Add \"arm_64bit=0\" > $CONFIG_FILE" + echo "Add \"arm_64bit=0\" > $CONFIG_FILE" fi fi From 6125959f1f3b06d5b824e896e7b41156217687a9 Mon Sep 17 00:00:00 2001 From: kurasawa Date: Wed, 11 Sep 2024 17:52:36 +0900 Subject: [PATCH 09/20] =?UTF-8?q?"dtparam=3Di2c=5Farm=3Don"=E3=81=A8"dtpar?= =?UTF-8?q?am=3Dspi=3Don"=E3=81=AE=E6=88=A6=E9=97=98=E3=81=AB#=E3=81=8C?= =?UTF-8?q?=E4=BB=98=E3=81=84=E3=81=A6=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88?= =?UTF-8?q?=E6=8B=85=E3=81=A3=E3=81=A6=E3=81=84=E3=81=9F=E5=A0=B4=E5=90=88?= =?UTF-8?q?=E3=81=AF=E8=A7=A3=E9=99=A4=E3=81=99=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/set_configs.bash | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/utils/set_configs.bash b/utils/set_configs.bash index ffcd2a5..87c7cfd 100755 --- a/utils/set_configs.bash +++ b/utils/set_configs.bash @@ -58,4 +58,16 @@ fi if grep -qxF 'dtparam=spi=off' "$CONFIG_FILE"; then sudo sed -i 's/dtparam=spi=off/dtparam=spi=on/' "$CONFIG_FILE" echo "changed \"dtparam=spi=off\" to \"dtparam=spi=on\" in $CONFIG_FILE" -fi \ No newline at end of file +fi + +# uncomment "dtparam=i2c_arm=on" if it is commented +if grep -qxF '#dtparam=i2c_arm=on' "$CONFIG_FILE"; then + sudo sed -i 's/#dtparam=i2c_arm=on/dtparam=i2c_arm=on/' "$CONFIG_FILE" + echo "uncommented \"dtparam=i2c_arm=on\" in $CONFIG_FILE" +fi + +# uncomment "dtparam=spi=on" if it is commented +if grep -qxF '#dtparam=spi=on' "$CONFIG_FILE"; then + sudo sed -i 's/#dtparam=spi=on/dtparam=spi=on/' "$CONFIG_FILE" + echo "uncommented \"dtparam=spi=on\" in $CONFIG_FILE" +fi From cce3fcc23f8ae473e27e417172a307302a9bbc26 Mon Sep 17 00:00:00 2001 From: kurasawa Date: Thu, 12 Sep 2024 16:27:45 +0900 Subject: [PATCH 10/20] =?UTF-8?q?=E5=8B=95=E4=BD=9C=E3=81=97=E3=81=A6?= =?UTF-8?q?=E3=81=84=E3=82=8BOS=E3=81=AEbit=E6=95=B0=E3=82=92=E5=88=A4?= =?UTF-8?q?=E5=AE=9A=E3=81=99=E3=82=8B=E3=82=B3=E3=83=9E=E3=83=B3=E3=83=89?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3=EF=BC=88uname=20-m=E3=81=A0?= =?UTF-8?q?=E3=81=A8Raspberry=20Pi=20OS=E3=81=AE32bit=E3=81=A7=E3=82=8264b?= =?UTF-8?q?it=E3=81=A8=E5=90=8C=E3=81=98=E7=B5=90=E6=9E=9C=E3=81=8C?= =?UTF-8?q?=E3=81=8B=E3=81=88=E3=81=A3=E3=81=A6=E3=81=8F=E3=82=8B=E3=81=9F?= =?UTF-8?q?=E3=82=81=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/set_configs.bash | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/set_configs.bash b/utils/set_configs.bash index 87c7cfd..17df7ba 100755 --- a/utils/set_configs.bash +++ b/utils/set_configs.bash @@ -5,7 +5,7 @@ set -eu SETTING_COMMENT='# Raspberry Pi Mouse V3 settings' # OS architecture (32-bit or 64-bit) -ARCHITECTURE=$(uname -m) +ARCHITECTURE=$(getconf LONG_BIT) # dtoverlay setting DTOVERLAY='dtoverlay=anyspi:spi0-0,dev="microchip,mcp3204",speed=1000000' @@ -25,7 +25,8 @@ if ! grep -qxF "$SETTING_COMMENT" "$CONFIG_FILE"; then echo "$SETTING_COMMENT" | sudo tee -a "$CONFIG_FILE" > /dev/null fi -if [[ "$ARCHITECTURE" == "armv7l" ]]; then +# check if the OS is running in 32-bit mode +if [[ "$ARCHITECTURE" == "32" ]]; then if ! grep -qxF "arm_64bit=0" "$CONFIG_FILE"; then echo "arm_64bit=0" | sudo tee -a "$CONFIG_FILE" echo "Add \"arm_64bit=0\" > $CONFIG_FILE" From 0cbb89e8cf27d233ccea23386a9ff15822e41c92 Mon Sep 17 00:00:00 2001 From: kurasawa Date: Thu, 12 Sep 2024 17:02:08 +0900 Subject: [PATCH 11/20] =?UTF-8?q?64bitOS=E3=81=AA=E3=81=AE=E3=81=ABarm=5F6?= =?UTF-8?q?4bit=3D0=E3=81=8C=E5=90=88=E3=81=A3=E3=81=9F=E5=A0=B4=E5=90=88?= =?UTF-8?q?=E3=81=AB=E5=89=8A=E9=99=A4=E3=81=99=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dtoverlayがkernel5.16未満にも関わらず記述されていた場合に削除するよう変更 --- utils/set_configs.bash | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/utils/set_configs.bash b/utils/set_configs.bash index 17df7ba..cbb5bf1 100755 --- a/utils/set_configs.bash +++ b/utils/set_configs.bash @@ -19,8 +19,7 @@ CONFIG_FILE='/boot/firmware/config.txt' # kernel version KERNEL_VERSION=$(uname -r | cut -d'.' -f1,2) - -# add Raspberry Pi Mouse V3 settings" +# add Raspberry Pi Mouse V3 settings if ! grep -qxF "$SETTING_COMMENT" "$CONFIG_FILE"; then echo "$SETTING_COMMENT" | sudo tee -a "$CONFIG_FILE" > /dev/null fi @@ -31,6 +30,12 @@ if [[ "$ARCHITECTURE" == "32" ]]; then echo "arm_64bit=0" | sudo tee -a "$CONFIG_FILE" echo "Add \"arm_64bit=0\" > $CONFIG_FILE" fi +elif [[ "$ARCHITECTURE" == "64" ]]; then + # remove arm_64bit=0 if present in a 64-bit environment + if grep -qxF "arm_64bit=0" "$CONFIG_FILE"; then + sudo sed -i '/arm_64bit=0/d' "$CONFIG_FILE" + echo "Removed \"arm_64bit=0\" from $CONFIG_FILE" + fi fi # add dtparam-setting for "/boot/firmware/config.txt" @@ -41,12 +46,17 @@ fi # use device-tree-overlay when the kernel is 5.16 or higher if (( $(echo "$KERNEL_VERSION >= 5.16" | bc -l) )); then - # add dtoverlay-setting for "/boot/firmware/config.txt" if ! grep -qxF "$DTOVERLAY" "$CONFIG_FILE"; then echo "$DTOVERLAY" | sudo tee -a "$CONFIG_FILE" >> /dev/null echo "Add \"$DTOVERLAY\" > $CONFIG_FILE" fi +else + # remove dtoverlay-setting if kernel is less than 5.16 + if grep -qxF "$DTOVERLAY" "$CONFIG_FILE"; then + sudo sed -i "/$DTOVERLAY/d" "$CONFIG_FILE" + echo "Removed \"$DTOVERLAY\" from $CONFIG_FILE" + fi fi # replace "dtparam=i2c_arm=off" with "dtparam=i2c_arm=on" From 524c6e9fd4fab5f64327520f52493d8fa3d39bb5 Mon Sep 17 00:00:00 2001 From: kurasawa Date: Thu, 12 Sep 2024 17:30:35 +0900 Subject: [PATCH 12/20] =?UTF-8?q?=E3=82=AB=E3=83=BC=E3=83=8D=E3=83=AB?= =?UTF-8?q?=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3=E3=81=AE=E6=AF=94?= =?UTF-8?q?=E8=BC=83=E3=81=8C=E6=AD=A3=E3=81=97=E3=81=8F=E8=A1=8C=E3=82=8F?= =?UTF-8?q?=E3=82=8C=E3=81=A6=E3=81=84=E3=81=AA=E3=81=8B=E3=81=A3=E3=81=9F?= =?UTF-8?q?=E3=81=9F=E3=82=81=E3=80=81=E6=95=B4=E6=95=B0=E3=81=AB=E5=A4=89?= =?UTF-8?q?=E6=8F=9B=E3=81=97=E3=81=A6=E6=AF=94=E8=BC=83=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/set_configs.bash | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/utils/set_configs.bash b/utils/set_configs.bash index cbb5bf1..c7d1af7 100755 --- a/utils/set_configs.bash +++ b/utils/set_configs.bash @@ -17,9 +17,19 @@ DTPARAM='dtparam=i2c_baudrate=62500' CONFIG_FILE='/boot/firmware/config.txt' # kernel version -KERNEL_VERSION=$(uname -r | cut -d'.' -f1,2) +# remove the dot from the version number and pad single-digit minor versions +KERNEL_VERSION=$(uname -r | cut -d'-' -f1) +KERNEL_VERSION_INT=$(echo "$KERNEL_VERSION" | awk -F. '{ printf "%d%02d", $1, $2 }') -# add Raspberry Pi Mouse V3 settings +# function to convert kernel version for comparison +KERNEL_VERSION_INT() { + echo "$1" | awk -F. '{ printf "%d%02d", $1, $2 }' +} + +# get the kernel version +result=$(KERNEL_VERSION_INT $(uname -r | cut -d'-' -f1)) + +# add raspberry pi mouse v3 settings if ! grep -qxF "$SETTING_COMMENT" "$CONFIG_FILE"; then echo "$SETTING_COMMENT" | sudo tee -a "$CONFIG_FILE" > /dev/null fi @@ -45,7 +55,7 @@ if ! grep -qxF "$DTPARAM" "$CONFIG_FILE"; then fi # use device-tree-overlay when the kernel is 5.16 or higher -if (( $(echo "$KERNEL_VERSION >= 5.16" | bc -l) )); then +if (( KERNEL_VERSION_INT >= $(KERNEL_VERSION_INT 5.16) )); then # add dtoverlay-setting for "/boot/firmware/config.txt" if ! grep -qxF "$DTOVERLAY" "$CONFIG_FILE"; then echo "$DTOVERLAY" | sudo tee -a "$CONFIG_FILE" >> /dev/null @@ -62,23 +72,23 @@ fi # replace "dtparam=i2c_arm=off" with "dtparam=i2c_arm=on" if grep -qxF 'dtparam=i2c_arm=off' "$CONFIG_FILE"; then sudo sed -i 's/dtparam=i2c_arm=off/dtparam=i2c_arm=on/' "$CONFIG_FILE" - echo "changed \"dtparam=i2c_arm=off\" to \"dtparam=i2c_arm=on\" in $CONFIG_FILE" + echo "Changed \"dtparam=i2c_arm=off\" to \"dtparam=i2c_arm=on\" in $CONFIG_FILE" fi # replace "dtparam=spi=off" with "dtparam=spi=on" if grep -qxF 'dtparam=spi=off' "$CONFIG_FILE"; then sudo sed -i 's/dtparam=spi=off/dtparam=spi=on/' "$CONFIG_FILE" - echo "changed \"dtparam=spi=off\" to \"dtparam=spi=on\" in $CONFIG_FILE" + echo "Changed \"dtparam=spi=off\" to \"dtparam=spi=on\" in $CONFIG_FILE" fi # uncomment "dtparam=i2c_arm=on" if it is commented if grep -qxF '#dtparam=i2c_arm=on' "$CONFIG_FILE"; then sudo sed -i 's/#dtparam=i2c_arm=on/dtparam=i2c_arm=on/' "$CONFIG_FILE" - echo "uncommented \"dtparam=i2c_arm=on\" in $CONFIG_FILE" + echo "Uncommented \"dtparam=i2c_arm=on\" in $CONFIG_FILE" fi # uncomment "dtparam=spi=on" if it is commented if grep -qxF '#dtparam=spi=on' "$CONFIG_FILE"; then sudo sed -i 's/#dtparam=spi=on/dtparam=spi=on/' "$CONFIG_FILE" - echo "uncommented \"dtparam=spi=on\" in $CONFIG_FILE" + echo "Uncommented \"dtparam=spi=on\" in $CONFIG_FILE" fi From 92e12c22658814de1d2a00184ae302aea694fbaa Mon Sep 17 00:00:00 2001 From: kurasawa Date: Fri, 13 Sep 2024 14:33:41 +0900 Subject: [PATCH 13/20] =?UTF-8?q?Ubuntu=E3=81=A8Raspberry=20Pi=20OS?= =?UTF-8?q?=E3=81=A7=E3=82=AB=E3=83=BC=E3=83=8D=E3=83=AB=E3=83=98=E3=83=83?= =?UTF-8?q?=E3=83=80=E3=83=BC=E3=81=AE=E6=89=8B=E9=A0=86=E3=81=8C=E9=81=95?= =?UTF-8?q?=E3=81=86=E3=81=AE=E3=81=A7README=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3a0c27c..d0c6a6c 100644 --- a/README.md +++ b/README.md @@ -26,10 +26,19 @@ $ cd RaspberryPiMouse/utils $ ./set_configs.bash ``` -PCを再起動した後、以下のコマンドを実行します。 +Raspberry Piを再起動し、以下のコマンドを実行してビルドに必要なファイルをインストールします。**`Ubuntu`と`Raspberry Pi OS`でコマンドが違います。** ```bash +# Ubuntu Server の場合 +$ sudo apt install linux-headers-$(uname -r) build-essential + +# Raspberry Pi OSの場合 $ sudo apt install raspberrypi-kernel-headers build-essential +``` + +以下のコマンドでビルドを実行します。 + +```bash $ cd RaspberryPiMouse/utils $ ./build_install.bash ``` From bae52c37153ed868314148feec3ff09c585566e6 Mon Sep 17 00:00:00 2001 From: kurasawa Date: Tue, 17 Sep 2024 15:24:05 +0900 Subject: [PATCH 14/20] =?UTF-8?q?CI=E7=B5=90=E6=9E=9C=E3=81=AE=E3=83=90?= =?UTF-8?q?=E3=83=83=E3=83=81=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d0c6a6c..de436ad 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # RaspberryPiMouse -![CI](https://github.com/rt-net/RaspberryPiMouse/workflows/CI/badge.svg?branch=master) +[![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) This repository has the source code and kernel objects for the Raspberry Pi Mouse. From 374da7c221e5e00379b0e823df0d4fdfb949041b Mon Sep 17 00:00:00 2001 From: Kazushi Kurasawa Date: Tue, 17 Sep 2024 15:38:17 +0900 Subject: [PATCH 15/20] =?UTF-8?q?README.md=E3=81=AE=E6=96=87=E4=B8=AD?= =?UTF-8?q?=E3=81=AE=E7=84=A1=E9=A7=84=E3=81=AA=E7=A9=BA=E7=99=BD=E3=82=92?= =?UTF-8?q?=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: YusukeKato --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index de436ad..bcefe12 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ $ ./set_configs.bash Raspberry Piを再起動し、以下のコマンドを実行してビルドに必要なファイルをインストールします。**`Ubuntu`と`Raspberry Pi OS`でコマンドが違います。** ```bash -# Ubuntu Server の場合 +# Ubuntu Serverの場合 $ sudo apt install linux-headers-$(uname -r) build-essential # Raspberry Pi OSの場合 From 90cd60dc0619198a0ae6d863335277324ad5580d Mon Sep 17 00:00:00 2001 From: kurasawa Date: Tue, 17 Sep 2024 16:07:06 +0900 Subject: [PATCH 16/20] =?UTF-8?q?=E3=83=AA=E3=83=9D=E3=82=B8=E3=83=88?= =?UTF-8?q?=E3=83=AA=E3=81=AEclone=E3=81=A8Raspberry=20Pi=E3=81=AE?= =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E3=82=92=E8=A1=8C=E3=81=86=E9=A0=85=E7=9B=AE?= =?UTF-8?q?=E3=81=AE=E8=AA=AC=E6=98=8E=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bcefe12..8350729 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Run the following scripts. ### for `Raspberry Pi OS`・`Ubuntu` -以下のコマンドでインストールを実行します。 +以下のコマンドで本リポジトリをダウンロードし、Raspberry Pi本体の設定を行います。 ```bash $ git clone https://github.com/rt-net/RaspberryPiMouse.git From f1b74a0f57faa5a369f061bcaf0a37dec46a05ca Mon Sep 17 00:00:00 2001 From: kurasawa Date: Tue, 17 Sep 2024 16:18:53 +0900 Subject: [PATCH 17/20] =?UTF-8?q?"/dev/null"=E3=81=B8=E3=81=AE=E3=83=AA?= =?UTF-8?q?=E3=83=80=E3=82=A4=E3=83=AC=E3=82=AF=E3=83=88=E3=82=92">"?= =?UTF-8?q?=E3=81=AB=E7=B5=B1=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/set_configs.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/set_configs.bash b/utils/set_configs.bash index c7d1af7..1b69619 100755 --- a/utils/set_configs.bash +++ b/utils/set_configs.bash @@ -50,7 +50,7 @@ fi # add dtparam-setting for "/boot/firmware/config.txt" if ! grep -qxF "$DTPARAM" "$CONFIG_FILE"; then - echo "$DTPARAM" | sudo tee -a "$CONFIG_FILE" >> /dev/null + echo "$DTPARAM" | sudo tee -a "$CONFIG_FILE" > /dev/null echo "Add \"$DTPARAM\" > $CONFIG_FILE" fi @@ -58,7 +58,7 @@ fi if (( KERNEL_VERSION_INT >= $(KERNEL_VERSION_INT 5.16) )); then # add dtoverlay-setting for "/boot/firmware/config.txt" if ! grep -qxF "$DTOVERLAY" "$CONFIG_FILE"; then - echo "$DTOVERLAY" | sudo tee -a "$CONFIG_FILE" >> /dev/null + echo "$DTOVERLAY" | sudo tee -a "$CONFIG_FILE" > /dev/null echo "Add \"$DTOVERLAY\" > $CONFIG_FILE" fi else From 606e958a37842c3fde8955662017b5d1aab54f79 Mon Sep 17 00:00:00 2001 From: kurasawa Date: Tue, 17 Sep 2024 16:38:10 +0900 Subject: [PATCH 18/20] =?UTF-8?q?=E3=82=AB=E3=83=BC=E3=83=8D=E3=83=AB?= =?UTF-8?q?=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3=E3=82=92=E6=89=B1?= =?UTF-8?q?=E3=81=86=E7=AE=87=E6=89=80=E3=82=92=E5=A4=89=E6=9B=B4=20-=20?= =?UTF-8?q?=E5=A4=89=E6=95=B0"KERNEL=5FVERSION=5FINT"=E3=81=A8=E9=96=A2?= =?UTF-8?q?=E6=95=B0"KERNEL=5FVERSION=5FINT()"=E3=81=8C=E5=90=8C=E5=90=8D?= =?UTF-8?q?=E3=81=A0=E3=81=A3=E3=81=9F=E3=81=9F=E3=82=81=E3=80=81=E9=96=A2?= =?UTF-8?q?=E6=95=B0=E3=82=92"GET=5FKERNEL=5FVERSION=5FINT()"=E3=81=AB?= =?UTF-8?q?=E7=90=86=E3=83=8D=E3=83=BC=E3=83=A0=20-=20=E9=96=A2=E6=95=B0"G?= =?UTF-8?q?ET=5FKERNEL=5FVERSION=5FINT()=20"=E3=82=92=E7=8F=BE=E5=9C=A8?= =?UTF-8?q?=E3=81=AE=E3=82=AB=E3=83=BC=E3=83=8D=E3=83=AB=E3=83=90=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E3=83=A7=E3=83=B3=E5=8F=96=E5=BE=97=E3=82=88=E3=82=8A?= =?UTF-8?q?=E5=89=8D=E3=81=AB=E5=AE=9A=E7=BE=A9=E3=81=97=E3=80=81=E8=87=AA?= =?UTF-8?q?=E8=BA=AB=E3=81=AE=E3=82=AB=E3=83=BC=E3=83=8D=E3=83=AB=E3=83=90?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3=E3=82=92=E6=95=B4=E6=95=B0?= =?UTF-8?q?=E5=80=A4=E3=81=AB=E5=A4=89=E6=8F=9B=E3=81=99=E3=82=8B=E9=9A=9B?= =?UTF-8?q?=E3=81=AB=E4=BD=BF=E7=94=A8=E3=81=99=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/set_configs.bash | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/utils/set_configs.bash b/utils/set_configs.bash index 1b69619..649b1d2 100755 --- a/utils/set_configs.bash +++ b/utils/set_configs.bash @@ -16,18 +16,15 @@ DTPARAM='dtparam=i2c_baudrate=62500' # config-file PATH CONFIG_FILE='/boot/firmware/config.txt' -# kernel version -# remove the dot from the version number and pad single-digit minor versions -KERNEL_VERSION=$(uname -r | cut -d'-' -f1) -KERNEL_VERSION_INT=$(echo "$KERNEL_VERSION" | awk -F. '{ printf "%d%02d", $1, $2 }') - # function to convert kernel version for comparison -KERNEL_VERSION_INT() { +GET_KERNEL_VERSION_INT() { echo "$1" | awk -F. '{ printf "%d%02d", $1, $2 }' } -# get the kernel version -result=$(KERNEL_VERSION_INT $(uname -r | cut -d'-' -f1)) +# kernel version +# remove the dot from the version number and pad single-digit minor versions +KERNEL_VERSION=$(uname -r | cut -d'-' -f1) +KERNEL_VERSION_INT=$(GET_KERNEL_VERSION_INT "$KERNEL_VERSION") # add raspberry pi mouse v3 settings if ! grep -qxF "$SETTING_COMMENT" "$CONFIG_FILE"; then @@ -55,7 +52,7 @@ if ! grep -qxF "$DTPARAM" "$CONFIG_FILE"; then fi # use device-tree-overlay when the kernel is 5.16 or higher -if (( KERNEL_VERSION_INT >= $(KERNEL_VERSION_INT 5.16) )); then +if (( KERNEL_VERSION_INT >= $(GET_KERNEL_VERSION_INT 5.16) )); then # add dtoverlay-setting for "/boot/firmware/config.txt" if ! grep -qxF "$DTOVERLAY" "$CONFIG_FILE"; then echo "$DTOVERLAY" | sudo tee -a "$CONFIG_FILE" > /dev/null From 5d1935fd196265491b65e98b8210eca6105ae7b9 Mon Sep 17 00:00:00 2001 From: kurasawa Date: Tue, 17 Sep 2024 17:45:04 +0900 Subject: [PATCH 19/20] =?UTF-8?q?=E3=82=AB=E3=83=BC=E3=83=8D=E3=83=AB?= =?UTF-8?q?=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3=E6=AF=94=E8=BC=83?= =?UTF-8?q?=E3=81=AE=E3=81=A8=E3=81=8D=E3=81=AB=E6=95=B4=E6=95=B0=E3=81=AB?= =?UTF-8?q?=E3=81=97=E3=81=A6=E3=81=84=E3=82=8B=E7=90=86=E7=94=B1=E3=81=A8?= =?UTF-8?q?=E3=83=9E=E3=82=A4=E3=83=8A=E3=83=BC=E3=83=90=E3=83=BC=E3=82=B8?= =?UTF-8?q?=E3=83=A7=E3=83=B3=E3=81=AE=E3=82=BC=E3=83=AD=E5=9F=8B=E3=82=81?= =?UTF-8?q?=E3=81=AB=E3=81=A4=E3=81=84=E3=81=A6=E3=82=B3=E3=83=A1=E3=83=B3?= =?UTF-8?q?=E3=83=88=E3=82=92=E8=BF=BD=E8=A8=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/set_configs.bash | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/set_configs.bash b/utils/set_configs.bash index 649b1d2..47a8d29 100755 --- a/utils/set_configs.bash +++ b/utils/set_configs.bash @@ -16,17 +16,17 @@ DTPARAM='dtparam=i2c_baudrate=62500' # config-file PATH CONFIG_FILE='/boot/firmware/config.txt' -# function to convert kernel version for comparison +# compare kernel versions as integers for accurate version comparison (excluding minor versions). GET_KERNEL_VERSION_INT() { - echo "$1" | awk -F. '{ printf "%d%02d", $1, $2 }' + # 0-padding is used to avoid minor versions being compared by their first digit. + echo "$1" | awk -F. '{ printf "%d%02d", $1, $2 }' } # kernel version -# remove the dot from the version number and pad single-digit minor versions KERNEL_VERSION=$(uname -r | cut -d'-' -f1) KERNEL_VERSION_INT=$(GET_KERNEL_VERSION_INT "$KERNEL_VERSION") -# add raspberry pi mouse v3 settings +# add "Raspberry Pi Mouse v3" settings if ! grep -qxF "$SETTING_COMMENT" "$CONFIG_FILE"; then echo "$SETTING_COMMENT" | sudo tee -a "$CONFIG_FILE" > /dev/null fi From a17dc194595ef8baa52c30995443783ea548970f Mon Sep 17 00:00:00 2001 From: kurasawa Date: Tue, 17 Sep 2024 18:33:24 +0900 Subject: [PATCH 20/20] =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E3=81=AB=E9=96=A2?= =?UTF-8?q?=E3=81=97=E3=81=A6=E3=81=84=E3=81=8F=E3=81=A4=E3=81=8B=E5=A4=89?= =?UTF-8?q?=E6=9B=B4=E3=82=92=E5=8A=A0=E3=81=88=E3=81=BE=E3=81=97=E3=81=9F?= =?UTF-8?q?=E3=80=82=20-=20=E4=BB=8A=E5=9B=9E=E3=81=8B=E3=82=89=E5=85=A8?= =?UTF-8?q?=E3=81=A6=E3=81=AE=E8=A8=AD=E5=AE=9A=E3=81=8C=E3=82=B9=E3=82=AF?= =?UTF-8?q?=E3=83=AA=E3=83=97=E3=83=88=E3=81=AB=E3=82=88=E3=81=A3=E3=81=A6?= =?UTF-8?q?=E8=87=AA=E5=8B=95=E3=81=A7=E6=9B=B8=E3=81=8D=E6=8F=9B=E3=82=8F?= =?UTF-8?q?=E3=82=8B=E3=81=9F=E3=82=81=E3=80=81=E5=85=88=E9=A0=AD=E3=81=A7?= =?UTF-8?q?=E3=81=AE=E3=81=BF=E3=81=93=E3=82=8C=E3=81=AB=E3=81=B5=E3=82=8C?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E5=A4=89=E6=9B=B4=20-=2032?= =?UTF-8?q?-bit=20OS=E3=81=AFUbuntu=2022.04=E3=81=A7=E3=82=82=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E3=81=99=E3=82=8B=E3=81=9F=E3=82=81=E3=80=81Raspberry?= =?UTF-8?q?=20Pi=20OS=E3=81=AE=E3=82=B9=E3=82=B3=E3=83=BC=E3=83=97?= =?UTF-8?q?=E3=81=8B=E3=82=89=E5=A4=96=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 8350729..f5a2994 100644 --- a/README.md +++ b/README.md @@ -54,9 +54,14 @@ $ sudo insmod rtmouse.ko ## Notes for the installation (ドライバの導入の際の注意) +特定の機能の有効化や、プログラムのビルドのために設定が必要な項目があります。以下の設定をご確認ください。 + +※[`./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))。 + + ### for Raspberry Pi OS -以下の設定を確認ください。※[`./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#L51-#L61))。 +Raspberry Pi OSでは、SPIとI2Cがデフォルトで無効となっているため、有効化する必要があります。 #### for SPI and I2C @@ -67,22 +72,13 @@ Enable SPI and I2C functions via `raspi-config` command. * SPI機能を「入」にする。 * I2C機能を「入」にする。 -#### for 32-bit OS - -Set 32bit-setting to `/boot/firmware/config.txt`. - -32-bit版のOSではビルドするために、`/boot/firmware/config.txt`に以下の1行を追加する必要があります。 - -```bash -arm_64bit=0 -``` - ### for Raspberry Pi 4 -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'. +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`. Raspberry Pi 4ではCPUのレジスタがそれまでのRaspberry Piとは異なります([issues#21](https://github.com/rt-net/RaspberryPiMouse/issues/21))。 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`に書き換えてビルドする必要があります。 + ※[`./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)。 ```c @@ -94,6 +90,16 @@ Raspberry Pi 4で本ドライバを使用する際には`rtmouse.c`の以下の #define RASPBERRYPI 2 ``` +### for 32-bit OS + +Set 32bit-setting to `/boot/firmware/config.txt`. + +32-bit版のOSではビルドするために、`/boot/firmware/config.txt`に以下の1行を追加する必要があります。 + +```bash +arm_64bit=0 +``` + ### デバイスツリーオーバーレイについて 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))。 pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy