From 2dee8a6c5697f3a52441dc2a29f5d5288c07823d Mon Sep 17 00:00:00 2001 From: yoyojacky Date: Thu, 9 May 2024 19:44:02 +0800 Subject: [PATCH] modify rules file and adding /etc/deskpi.conf Signed-off-by: yoyojacky --- installation/deskpi-config | 15 ++++++++++----- installation/install.sh | 18 +++++++++++++++++- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/installation/deskpi-config b/installation/deskpi-config index 5ec0ae1..4d1ee2f 100755 --- a/installation/deskpi-config +++ b/installation/deskpi-config @@ -11,10 +11,11 @@ . /lib/lsb/init-functions # This is the serial port that connect to deskPi mainboard and it will # communicate with Raspberry Pi and get the signal for fan speed adjusting. -serial_port='/dev/DeskPi_FAN' +serial_port='/dev/ttyUSB0' # Stop deskpi.service so that user can define the speed level. sudo systemctl stop deskpi.service +sudo systemctl daemon-reload # Define the function of set_config function set_config() { @@ -41,7 +42,8 @@ function set_config() { } # Greetings and information for user. -echo "Welcome to Use DeskPi-Team's Product" +# +echo "DESKPI PRO FAN CONTROL" | figlet -c echo "Please select speed level that you want: " echo "It will always run at the speed level that you choosed." echo "---------------------------------------------------------------" @@ -83,13 +85,16 @@ case $levelNumber in ;; 6) echo "Customizing the start speed level according the temperature" - sudo systemctl stop deskpi.service & + sudo systemctl stop deskpi.service + sudo systemctl daemon-reload set_config - sudo systemctl start deskpi.service & + sudo systemctl daemon-reload + sudo systemctl start deskpi.service ;; 7) echo "Cancel manual control and enable automatical fan control" - sudo systemctl start deskpi.service & + sudo systemctl daemon-reload + sudo systemctl restart deskpi.service ;; *) echo "You type the wrong selection, please try again!" diff --git a/installation/install.sh b/installation/install.sh index 0e05673..8cf3853 100755 --- a/installation/install.sh +++ b/installation/install.sh @@ -44,12 +44,28 @@ deskpi_rules_file="/etc/udev/rules.d/10-deskpi.rules" if [[ ! -e $deskpi_rules_file ]]; then sudo sh -c "sudo cat < '$deskpi_rules_file' - ACTION==\"add\", ATTRS{\"$idVendor\"},ATTRS{\"$idProduct\"},SYMLINK+=\"DeskPi_FAN\" + ACTION==\"add\",SUBSYSTEM==\"tty\",ATTRS{\"$idVendor\"},ATTRS{\"$idProduct\"},SYMLINK+=\"DeskPi_FAN\" EOF" + sudo sh -c "sudo chmod 0666 $deskpi_rules_file" sudo sh -c "sudo udevadm control --reload-rules" sudo sh -c "sudo udevadm trigger" fi +# Adding /etc/deskpi.conf file +deskpi_config="/etc/deskpi.conf" +if [[ ! -e $deskpi_config ]]; then + sh -c "cat < '$deskpi_config' + 40 + 100 + 50 + 100 + 55 + 100 + 60 + 100 + EOF" +fi + # Remove old repository. if [[ -d /tmp/deskpi ]]; then rm -rf /tmp/deskpi*