fixed module version
authorMiroslav Ondra <ondra@faster.cz>
Thu, 2 Aug 2018 20:00:28 +0000 (22:00 +0200)
committerMiroslav Ondra <ondra@faster.cz>
Thu, 2 Aug 2018 20:00:28 +0000 (22:00 +0200)
fixed processing on-boot undefined boards
fixed raspbian script

modules/unipi/raspbian
modules/unipi/src/unipi_common.h
modules/unipi/src/unipi_spi.c
modules/unipi/src/unipi_tty.c

index c6df7063993ae6579689e611562b5e95a18173b6..b48e09d981e5d64cc5ea1d4198d115e6444ca477 100755 (executable)
@@ -1,10 +1,17 @@
 #!/bin/bash
 
-mkdir -p tmp
-wget -q http://archive.raspberrypi.org/debian/dists/stretch/main/binary-armhf/Packages.gz -O - | gunzip \
-| awk '/^Package: raspberrypi-kernel-headers[[:blank:]]*$/ { ok=1; next} /^Package: / {ok=0;} (ok!=1) {next} 
-/^Version: / {print "RPI_FIRMWARE_VER=" $2 } 
-/^Filename: / {print "RPI_FIRMWARE_FILE=" $2; nextfile }' > tmp/versions
+###############################################
+#
+# for new version checking delete file tmp/versions
+#
+#################################################
+if [ -s tmp/versions ]; then
+       mkdir -p tmp
+       wget -q http://archive.raspberrypi.org/debian/dists/stretch/main/binary-armhf/Packages.gz -O - | gunzip \
+       | awk '/^Package: raspberrypi-kernel-headers[[:blank:]]*$/ { ok=1; next} /^Package: / {ok=0;} (ok!=1) {next} 
+       /^Version: / {print "RPI_FIRMWARE_VER=" $2 } 
+       /^Filename: / {print "RPI_FIRMWARE_FILE=" $2; nextfile }' > tmp/versions
+fi
 
 cd tmp
 . versions
@@ -16,17 +23,21 @@ cd tmp
 
 # alternate method to get raspberrypi-kernel_${RPI_FIRMWARE_VER}.zip
 # get commit number used for making this kernel version
-wget https://raw.githubusercontent.com/raspberrypi/firmware/stable/extra/git_hash -O- > .git_hash
-GIT_VER=`cat .git_hash`
-wget https://github.com/raspberrypi/linux/archive/$GIT_VER.zip -O raspberrypi-kernel_${RPI_FIRMWARE_VER}.zip
-unzip raspberrypi-kernel_${RPI_FIRMWARE_VER}.zip
-mv linux-$GIT_VER linux-raspberrypi-kernel_${RPI_FIRMWARE_VER}
-#-----------------------------------------------------------------------
-rm raspberrypi-kernel_${RPI_FIRMWARE_VER}.zip
+if [ ! -d linux-raspberrypi-kernel_${RPI_FIRMWARE_VER} ]; then
+       wget https://raw.githubusercontent.com/raspberrypi/firmware/stable/extra/git_hash -O- > .git_hash
+       GIT_VER=`cat .git_hash`
+       wget https://github.com/raspberrypi/linux/archive/$GIT_VER.zip -O raspberrypi-kernel_${RPI_FIRMWARE_VER}.zip
+       unzip raspberrypi-kernel_${RPI_FIRMWARE_VER}.zip
+       mv linux-$GIT_VER linux-raspberrypi-kernel_${RPI_FIRMWARE_VER}
+       #-----------------------------------------------------------------------
+       rm raspberrypi-kernel_${RPI_FIRMWARE_VER}.zip
+fi
 
-wget http://archive.raspberrypi.org/debian/${RPI_FIRMWARE_FILE}
-dpkg-deb -x `basename ${RPI_FIRMWARE_FILE}` h
-### raspberrypi-kernel-headers_1.20180417-1_armhf.deb h
+if [ ! -r `basename ${RPI_FIRMWARE_FILE}` ]; then
+       wget http://archive.raspberrypi.org/debian/${RPI_FIRMWARE_FILE}
+       dpkg-deb -x `basename ${RPI_FIRMWARE_FILE}` h
+       ### raspberrypi-kernel-headers_1.20180417-1_armhf.deb h
+fi
 
 KERNEL_VER=`ls -1 h/lib/modules | grep '\-v7'`
 echo $KERNEL_VER
index a09f806e1f2e6e06cc1e055b9d4ab5d403c883a3..4fed88212a57e3fa732409262696e35166688ef8 100644 (file)
@@ -51,7 +51,7 @@
 #if NEURONSPI_SCHED_REQUIRED > 0
        #include <uapi/linux/sched/types.h>
 #endif
-#define NEURONSPI_MAJOR_VERSIONSTRING "Version 1.13:2018:07:19"
+#define NEURONSPI_MAJOR_VERSIONSTRING "Version 1.14:2018:08:02"
 
 #define NEURONSPI_MAX_DEVS                             3
 #define NEURONSPI_MAX_UART                             128
index 9557df7108ad6bca6fa9ceffb217636e64a1cbf5..a78be0731b9aa564c8d764278327a9f4d647512c 100644 (file)
@@ -140,7 +140,7 @@ ssize_t neuronspi_read (struct file *file_p, char *buffer, size_t len, loff_t *o
     driver_data = spi_get_drvdata(spi_driver_data);
     if (driver_data == NULL) return -2;
     if (driver_data->spi_driver == NULL) return -2;    // Invalid private data
-    if (driver_data->first_probe_reply[0] == 0) return -3; // No device present
+    if ((driver_data->first_probe_reply[0] == 0) && !(driver_data->probe_always_succeeds) ) return -3; // Device not present
     mutex_lock(&(private_data->lock));
     if (private_data->recv_buf == NULL) {
        mutex_unlock(&(private_data->lock));
@@ -211,7 +211,7 @@ ssize_t neuronspi_write (struct file *file_p, const char *buffer, size_t len, lo
     driver_data = spi_get_drvdata(spi_driver_data);
     if (driver_data == NULL) return -2;
     if (driver_data->spi_driver == NULL) return -2;    // Invalid private data
-    if (driver_data->first_probe_reply[0] == 0) return -3; // Device not present
+    if ((driver_data->first_probe_reply[0] == 0) && !(driver_data->probe_always_succeeds) ) return -3; // Device not present
     send_header = buffer[3];
     if (buffer[4]) {   // Frequency setting
        frequency = (buffer[4] << 8 | buffer[5]) * 1000;
index a18dbd044262594b24afde2382fc2e29b803c7ce..a6aa074157fe0e1c73b810c72a12860522319ee9 100644 (file)
@@ -930,6 +930,7 @@ static int unipi_tty_ioctl(struct tty_struct *tty, struct file *file,
        }
 }
 
+#ifdef CONFIG_COMPAT
 static long unipi_tty_compat_ioctl(struct tty_struct *tty, struct file *file,
                       unsigned int cmd, unsigned long arg)
 {
@@ -949,7 +950,7 @@ static long unipi_tty_compat_ioctl(struct tty_struct *tty, struct file *file,
                return n_tty_compat_ioctl_helper(tty, file, cmd, arg);
        }
 }
-
+#endif
 
 static struct tty_ldisc_ops unipi_tty_ops = {
        .magic           = TTY_LDISC_MAGIC,
@@ -961,7 +962,9 @@ static struct tty_ldisc_ops unipi_tty_ops = {
        .read            = unipi_tty_read,
        .write           = unipi_tty_write,
        .ioctl           = unipi_tty_ioctl,
+#ifdef CONFIG_COMPAT
        .compat_ioctl    = unipi_tty_compat_ioctl,
+#endif
        .set_termios     = unipi_tty_set_termios,
        .poll            = unipi_tty_poll,
        .receive_buf     = unipi_tty_receive_buf,