summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO54
-rw-r--r--0002-kernel-5.6-proc_dir_entry-proc_ops.patch160
-rw-r--r--0003-tty_unregister_driver-void.patch31
-rw-r--r--0004-kernel-5.12-tty-low_latency.patch69
-rw-r--r--0005-kernel-5.14-unsigned-tty-flow-tty.patch109
-rw-r--r--0006-kernel-5.15-alloc_tty_driver-put_tty_driver.patch41
-rw-r--r--0007-service-priority.patch30
-rw-r--r--0008-python3-firmware.patch199
-rw-r--r--0009-python3-nslink.patch45
-rw-r--r--0010-kernel-6.1-TTY_DRIVER_MAGIC-remove-dead-code.patch15
-rw-r--r--0011-kernel-6.0-set_termios-const-ktermios.patch19
-rw-r--r--0012-kernel-6.6-struct-tty_operations-write-size_t.patch19
-rw-r--r--0013-kernel-6.3-tty_port_operations-int-to-bool.patch35
-rw-r--r--PKGBUILD149
14 files changed, 945 insertions, 30 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 67624dec6125..17d059f6f73a 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,9 +1,7 @@
-# Generated by mksrcinfo v8
-# Sat Nov 24 23:46:14 UTC 2018
pkgbase = nslink
pkgdesc = tty driver and firmware update for Comtrol DeviceMaster, RTS, LT, PRO, 500, UP, RPSH-SI, RPSH, and Serial port Hub console terminal device server
- pkgver = 7.34
- pkgrel = 1
+ pkgver = 8.00
+ pkgrel = 7
url = http://www.comtrol.com/
install = nslink-install.sh
arch = i686
@@ -11,7 +9,7 @@ pkgbase = nslink
license = GPL
depends = glibc
depends = openssl
- depends = python2
+ depends = python3
depends = sed
depends = groff
depends = tcl
@@ -24,12 +22,50 @@ pkgbase = nslink
options = !zipman
options = !strip
backup = etc/nslink.conf
- source = http://downloads.comtrol.com/beta/dev_mstr/rts/drivers/linux/devicemaster-linux-7.34.tar.gz
- source = http://downloads.comtrol.com/dev_mstr/rts/utility/linux_firmware_uploader/DM-Firmware-Updater-1.06.tar.gz
+ source = https://downloads.comtrol.com/dev_mstr/rts/drivers/linux/devicemaster-linux-8.00.tar.gz
+ source = https://downloads.comtrol.com/dev_mstr/rts/utility/linux_firmware_uploader/DM-Firmware-Updater-1.06.tar.gz
source = dmupdate.py.usage.patch
- sha256sums = 4434d75078db4c4d8406fc3013bd76dbac2d11133062de9ee1cfff4db533773b
+ source = 0002-kernel-5.6-proc_dir_entry-proc_ops.patch
+ source = 0003-tty_unregister_driver-void.patch
+ source = 0004-kernel-5.12-tty-low_latency.patch
+ source = 0005-kernel-5.14-unsigned-tty-flow-tty.patch
+ source = 0006-kernel-5.15-alloc_tty_driver-put_tty_driver.patch
+ source = 0007-service-priority.patch
+ source = 0008-python3-firmware.patch
+ source = 0009-python3-nslink.patch
+ source = 0010-kernel-6.1-TTY_DRIVER_MAGIC-remove-dead-code.patch
+ source = 0011-kernel-6.0-set_termios-const-ktermios.patch
+ source = 0012-kernel-6.6-struct-tty_operations-write-size_t.patch
+ source = 0013-kernel-6.3-tty_port_operations-int-to-bool.patch
+ md5sums = b59906d80268e69a24c211b398ffd10c
+ md5sums = e3ffb36acfdd321c919e44d477f0774a
+ md5sums = 581cd5f582ed20c7cf85a4df23a9f78a
+ md5sums = 36fcfa504772df4aabbde9f23d5459d5
+ md5sums = 7e0659716e30c6e2ff5c16f20aac07be
+ md5sums = 4e0c61dc0c5da4c3125db7ac1e481aac
+ md5sums = 93e85c98fd375285887b78f2df44ce01
+ md5sums = f85645dfe886b57273b475d3c6cd0964
+ md5sums = e5692035f047cdec52658f67954c6f4d
+ md5sums = 8c329cf0f9c90cfd07ba86a4027eec48
+ md5sums = e21d8211b2f209ace648340cb5583805
+ md5sums = 2774e3aa64717a7613e96fd86f649ea1
+ md5sums = 98788ff1378604e9fda43eb6ef9e9e3d
+ md5sums = feb1ccc7522a6ac2b33326c7f648edb2
+ md5sums = 1ff77ae8edbcd654c680999eadd4911b
+ sha256sums = 092859a3c198f8e3f5083a752eab0af74ef71dce59ed503d120792be13cc5fa3
sha256sums = d21c5eeefdbf08a202a230454f0bf702221686ba3e663eb41852719bb20b75fb
sha256sums = 5a4e2713a8d1fe0eebd94fc843839ce5daa647f9fa7d88f62507e660ae111073
+ sha256sums = cbaa55f16357688b992a7d7c0f2fb56225edda286d97595918c50e05005d1318
+ sha256sums = 7b7718789a4a23c3f16094f93b9fc0d8a5915e67e6a0aedef17cdb6adb22a1ac
+ sha256sums = a48cdf948f907b00919c3a2dadbaa2c41c28891d689195e072765c39b0b4af49
+ sha256sums = 12c55d7b898b5cdcd09d6927fef1585a702fde356e8e039e7e85bbce64f3eed8
+ sha256sums = 364a4fb9d8695067ee8d235d7763c59f6df417937b901a1810e00d397db21aee
+ sha256sums = bfa34783131c52e0bc0645c76469aaf504b13ac16d57b02d5ea9002603fb583e
+ sha256sums = 1353bc403b56ef0b00f4b87826991812ee24bcc9a0b2612c0027317a7aa86736
+ sha256sums = a84e1a9884580917afe55816b4ec9b44ec0f4977144e7f4325647ff58642ecd6
+ sha256sums = 2b909997f0662ae9a49463be4c1ef2af718882924071e0d74b9c04d9d1198691
+ sha256sums = 7f181d1542b542989b319caf85621725389d7681cf2d5c3bb57dc774d14f1b76
+ sha256sums = 5a62d3658d716c8140de65c2ac2e2560ca33f0f2a58212e29df74eadb821b6ce
+ sha256sums = 4c605df9b08ea2be3b3c94a2dab8554902ff15576a7075c597453306c275e3e2
pkgname = nslink
-
diff --git a/0002-kernel-5.6-proc_dir_entry-proc_ops.patch b/0002-kernel-5.6-proc_dir_entry-proc_ops.patch
new file mode 100644
index 000000000000..0ac56c97f979
--- /dev/null
+++ b/0002-kernel-5.6-proc_dir_entry-proc_ops.patch
@@ -0,0 +1,160 @@
+--- nslink.c.orig 2020-05-21 00:58:54.304970216 -0400
++++ nslink.c 2020-05-21 01:04:05.147271869 -0400
+@@ -5031,17 +5031,26 @@ static int queue_proc_show(struct seq_fi
+ }
+ static int queue_proc_open(struct inode *inode, struct file *file)
+ {
+ return single_open(file, queue_proc_show, NULL);
+ }
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)
++static const struct proc_ops queue_proc_fops = {
++ .proc_open = queue_proc_open,
++ .proc_read = seq_read,
++ .proc_lseek = seq_lseek,
++ .proc_release = seq_release,
++};
++#else
+ static const struct file_operations queue_proc_fops = {
+ .open = queue_proc_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = seq_release,
+ };
+ #endif
++#endif
+
+
+ #if NSLINK_DEBUG_TRACE_HDLC
+
+ static char *stopString[] = {
+@@ -5089,17 +5098,26 @@ static int ack_proc_show(struct seq_file
+ }
+ static int ack_proc_open(struct inode *inode, struct file *file)
+ {
+ return single_open(file, ack_proc_show, NULL);
+ }
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)
++static const struct proc_ops ack_proc_fops = {
++ .proc_open = ack_proc_open,
++ .proc_read = seq_read,
++ .proc_lseek = seq_lseek,
++ .proc_release = seq_release,
++};
++#else
+ static const struct file_operations ack_proc_fops = {
+ .open = ack_proc_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = seq_release,
+ };
+ #endif
++#endif
+
+ #define NumElements(a) (sizeof (a)/(sizeof (a)[0]))
+
+ // Implements the /proc/driver/nslink/port method.
+ static int port_proc_show(struct seq_file *m, void *v)
+@@ -5162,16 +5180,25 @@ static int port_proc_show(struct seq_fil
+ }
+ static int port_proc_open(struct inode *inode, struct file *file)
+ {
+ return single_open(file, port_proc_show, NULL);
+ }
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)
++static const struct proc_ops port_proc_fops = {
++ .proc_open = port_proc_open,
++ .proc_read = seq_read,
++ .proc_lseek = seq_lseek,
++ .proc_release = seq_release,
++};
++#else
+ static const struct file_operations port_proc_fops = {
+ .open = port_proc_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = seq_release,
+ };
++#endif
+
+
+ // Implements the /proc/driver/nslink/hdlc method.
+ static int hdlc_proc_show(struct seq_file *m, void *v)
+ {
+@@ -5203,16 +5230,25 @@ static int hdlc_proc_show(struct seq_fil
+ }
+ static int hdlc_proc_open(struct inode *inode, struct file *file)
+ {
+ return single_open(file, hdlc_proc_show, NULL);
+ }
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)
++static const struct proc_ops hdlc_proc_fops = {
++ .proc_open = hdlc_proc_open,
++ .proc_read = seq_read,
++ .proc_lseek = seq_lseek,
++ .proc_release = seq_release,
++};
++#else
+ static const struct file_operations hdlc_proc_fops = {
+ .open = hdlc_proc_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = seq_release,
+ };
++#endif
+
+
+ // Implements the /proc/driver/nslink/hdlc-queue method.
+ static int hdlc_queue_proc_show(struct seq_file *m, void *v)
+ {
+@@ -5258,16 +5294,25 @@ static int hdlc_queue_proc_show(struct s
+ }
+ static int hdlc_queue_proc_open(struct inode *inode, struct file *file)
+ {
+ return single_open(file, hdlc_queue_proc_show, NULL);
+ }
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)
++static const struct proc_ops hdlc_queue_proc_fops = {
++ .proc_open = hdlc_queue_proc_open,
++ .proc_read = seq_read,
++ .proc_lseek = seq_lseek,
++ .proc_release = seq_release,
++};
++#else
+ static const struct file_operations hdlc_queue_proc_fops = {
+ .open = hdlc_queue_proc_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = seq_release,
+ };
++#endif
+
+
+ const char *inet_addr_string(struct sockaddr_storage *ss)
+ {
+ static char buf[256];
+@@ -5324,16 +5369,25 @@ static int status_proc_show(struct seq_f
+ }
+ static int status_proc_open(struct inode *inode, struct file *file)
+ {
+ return single_open(file, status_proc_show, NULL);
+ }
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0)
++static const struct proc_ops status_proc_fops = {
++ .proc_open = status_proc_open,
++ .proc_read = seq_read,
++ .proc_lseek = seq_lseek,
++ .proc_release = seq_release,
++};
++#else
+ static const struct file_operations status_proc_fops = {
+ .open = status_proc_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = seq_release,
+ };
++#endif
+
+ /********************************************************************************/
+ /* */
+ /* MODULE INIT/CLEANUP FUNCTIONS */
+ /* */
diff --git a/0003-tty_unregister_driver-void.patch b/0003-tty_unregister_driver-void.patch
new file mode 100644
index 000000000000..ef77a9d46b02
--- /dev/null
+++ b/0003-tty_unregister_driver-void.patch
@@ -0,0 +1,31 @@
+--- nslink.c.orig 2020-10-29 11:49:44.000000000 -0400
++++ nslink.c 2021-08-10 16:35:56.677430829 -0400
+@@ -5671,11 +5671,11 @@ int nrp_init(void)
+ return 0;
+ }
+
+ static void nrp_cleanup_module(void)
+ {
+- int retval, i;
++ int i;
+ printk(KERN_INFO "nslink: starting driver module shutdown\n");
+
+ remove_proc_entry("driver/nslink/status",0);
+ remove_proc_entry("driver/nslink/hdlc",0);
+ remove_proc_entry("driver/nslink/ports",0);
+@@ -5697,14 +5697,12 @@ static void nrp_cleanup_module(void)
+
+ for (i = 0; i < numBoxes; i++)
+ free_si_box(i);
+
+ if (driver_registered) {
+- retval = tty_unregister_driver(nslink_driver);
++ tty_unregister_driver(nslink_driver);
+ put_tty_driver(nslink_driver);
+- if (retval)
+- printk(KERN_INFO "nslink: Error %d while trying to unregister Nslink driver\n", -retval);
+ }
+
+ printk(KERN_INFO "nslink: finished driver module shutdown\n");
+ return;
+ }
diff --git a/0004-kernel-5.12-tty-low_latency.patch b/0004-kernel-5.12-tty-low_latency.patch
new file mode 100644
index 000000000000..874accca8f62
--- /dev/null
+++ b/0004-kernel-5.12-tty-low_latency.patch
@@ -0,0 +1,69 @@
+--- nslink.c.orig 2021-08-10 16:38:55.351971026 -0400
++++ nslink.c 2021-08-10 16:40:03.424715195 -0400
+@@ -2505,14 +2505,16 @@ static void init_nr_port(struct si_state
+ info->close_delay = 500; //ms
+ info->baud_rate = 9600;
+ info->baud_base = 0;
+ // don't set low latency flag on MAC-mode ports, or it causes
+ // problems when tty_flip_buffer_push() is called
++#if LINUX_VERSION_CODE < VERSION_CODE(5,12,0)
+ if (low_latency && si->use_tcp)
+ info->port.flags |= ASYNC_LOW_LATENCY;
+ else
+ info->port.flags &= ~ASYNC_LOW_LATENCY;
++#endif
+ info->rx_fifo_disable = rx_fifo_disable;
+
+ // check for invalid RS mode setting
+
+ if (UnitHasOnly232(si->modelID) && (si->rsmode[portnum] != SI_RSMODE_232)) {
+@@ -3311,12 +3313,14 @@ static int set_serial_info(struct nr_por
+ if (new_serial.closing_wait != ASYNC_CLOSING_WAIT_NONE)
+ new_serial.closing_wait *= 10;
+
+ // don't allow low_latency mode in MAC mode since it causes problems
+ // when tty_flip_buffer_push() is called.
++#if LINUX_VERSION_CODE < VERSION_CODE(5,12,0)
+ if (!info->si->use_tcp)
+ new_serial.flags &= ~ASYNC_LOW_LATENCY;
++#endif
+
+ #ifdef CAP_SYS_ADMIN
+ if (!capable(CAP_SYS_ADMIN))
+ #else
+ if (!suser())
+@@ -3333,12 +3337,14 @@ static int set_serial_info(struct nr_por
+ }
+
+ info->baud_base = new_serial.baud_base;
+ info->custom_divisor = new_serial.custom_divisor;
+
++#if LINUX_VERSION_CODE < VERSION_CODE(5,12,0)
+ if (info->tty)
+ nrp_tty_is_low_latency(info->tty) = (info->port.flags & ASYNC_LOW_LATENCY) != 0;
++#endif
+
+ info->inter_char_timeout = new_serial.irq;
+ if (UnitHasNewTimeoutCommands(info->si))
+ info->update_ic_timeout = 1;
+
+@@ -3786,17 +3792,19 @@ static int nrp_write(struct tty_struct *
+
+ end:
+ up(&info->write_sem);
+
+ // Call the routines to send data to hub
++#if LINUX_VERSION_CODE < VERSION_CODE(5,12,0)
+ if (info->tty && nrp_tty_is_low_latency(info->tty)) {
+ info->si->need_to_send = 1;
+ if (info->si->use_tcp == 0)
+ si_timer((callback_param_type)&info->si->timer);
+ else
+ tcp_send_remote_cmds(info->si);
+ }
++#endif
+ #ifdef NSLINK_DEBUG_WRITE
+ printk(KERN_INFO "ret=%d\n", retval);
+ #endif
+
+ return retval;
diff --git a/0005-kernel-5.14-unsigned-tty-flow-tty.patch b/0005-kernel-5.14-unsigned-tty-flow-tty.patch
new file mode 100644
index 000000000000..9c8fce087cff
--- /dev/null
+++ b/0005-kernel-5.14-unsigned-tty-flow-tty.patch
@@ -0,0 +1,109 @@
+--- nslink.c.orig 2021-09-12 22:30:11.942180898 -0400
++++ nslink.c 2021-09-12 22:30:37.085578537 -0400
+@@ -1401,11 +1401,17 @@ retry:
+
+ /*
+ * Transmit characters in our transmit buffer
+ */
+ if (info->x_char ||
+- (info->xmit_cnt && info->tty && !info->tty->hw_stopped && !info->tty->stopped)) {
++ (info->xmit_cnt && info->tty && !info->tty->hw_stopped && !
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
++ info->tty->flow.stopped
++#else
++ info->tty->stopped
++#endif
++ )) {
+ if (!hdlc_xmit(si, skb, info, pstate))
+ send_packet = 1;
+ }
+ } else if (info->remote_status == REM_OPEN_PORT) {
+ if (hdlc_1byte_cmd(si, skb, i, RK_REMOTE_STATUS, REM_OPEN_PORT)) {
+@@ -3484,11 +3490,17 @@ static void nrp_start(struct tty_struct
+ /*
+ * Start the transmitter remotely, if we ever add a stop
+ * transmitter to nrp_stop.
+ */
+
+- if (info->xmit_cnt <= 0 || tty->stopped || tty->hw_stopped ||
++ if (info->xmit_cnt <= 0 ||
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
++ tty->flow.stopped
++#else
++ tty->stopped
++#endif
++ || tty->hw_stopped ||
+ !info->xmit_buf)
+ return;
+
+ info->si->need_to_send = 1;
+ if (info->si->use_tcp == 0)
+@@ -3692,11 +3704,16 @@ static void nrp_flush_chars(struct tty_s
+ pstate = &info->si->port_state[info->portnum];
+ if (pstate)
+ space = get_tx_space_remote(pstate);
+
+ if (space <= WAKEUP_CHARS || info->xmit_cnt <= 0 ||
+- tty->stopped || tty->hw_stopped || !info->xmit_buf)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
++ tty->flow.stopped
++#else
++ tty->stopped
++#endif
++ || tty->hw_stopped || !info->xmit_buf)
+ return;
+
+ info->si->need_to_send = 1;
+ if (info->si->use_tcp == 0) {
+ if (info->xmit_cnt > 64)
+@@ -3813,11 +3830,15 @@ end:
+ /*
+ * Return the number of characters that can be sent. We estimate
+ * only using the in-memory transmit buffer only, and ignore the
+ * potential space in the remote end.
+ */
++#if LINUX_VERSION_CODE >= VERSION_CODE(5,14,0)
++static unsigned int nrp_write_room(struct tty_struct *tty)
++#else
+ static int nrp_write_room(struct tty_struct *tty)
++#endif
+ {
+ struct nr_port *info = (struct nr_port *) tty->driver_data;
+ int ret;
+
+ if (nslink_paranoia_check(info, "nrp_write_room"))
+@@ -3834,11 +3855,15 @@ static int nrp_write_room(struct tty_str
+
+ /*
+ * Return the number of characters in the buffer. Again, this only
+ * counts those characters in the in-memory transmit buffer.
+ */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
++static unsigned int nrp_chars_in_buffer(struct tty_struct *tty)
++#else
+ static int nrp_chars_in_buffer(struct tty_struct *tty)
++#endif
+ {
+ struct nr_port *info = (struct nr_port *) tty->driver_data;
+
+ if (nslink_paranoia_check(info, "nrp_chars_in_buffer"))
+ return 0;
+@@ -4617,11 +4642,17 @@ static void tcp_send_remote_cmds(struct
+ info->update_action = 0;
+ info->action_register = 0;
+ }
+ if (info->x_char ||
+ (info->xmit_cnt && info->tty &&
+- !info->tty->hw_stopped && !info->tty->stopped)) {
++ !info->tty->hw_stopped &&
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
++ !info->tty->flow.stopped
++#else
++ !info->tty->stopped
++#endif
++ )) {
+ if (tcp_room(si, bi, 4)) {
+ bi = 0;
+ continue;
+ }
+ dc = tcp_out_data(buf, bi, info, pstate, si);
diff --git a/0006-kernel-5.15-alloc_tty_driver-put_tty_driver.patch b/0006-kernel-5.15-alloc_tty_driver-put_tty_driver.patch
new file mode 100644
index 000000000000..ac39dd01d743
--- /dev/null
+++ b/0006-kernel-5.15-alloc_tty_driver-put_tty_driver.patch
@@ -0,0 +1,41 @@
+--- nslink.c.orig 2021-11-20 15:13:52.248938958 -0500
++++ nslink.c 2021-11-20 15:15:42.252800968 -0500
+@@ -5634,11 +5634,11 @@ int register_tty_driver(tBoxPortCount *u
+
+ numBoxes = bp.boxCount;
+
+ // Set up the tty driver structure and then register this
+ // driver with the tty layer.
+- nslink_driver = alloc_tty_driver((MAX_NRP_TOTAL_PORTS - 1));
++ nslink_driver = tty_alloc_driver((MAX_NRP_TOTAL_PORTS - 1),0);
+
+ nslink_driver->magic = TTY_DRIVER_MAGIC;
+ nslink_driver->driver_name = "NS-Link";
+ nslink_driver->name = "ttySI";
+ nslink_driver->num = bp.portCount;
+@@ -5661,11 +5661,11 @@ int register_tty_driver(tBoxPortCount *u
+ nslink_driver->owner = THIS_MODULE;
+ tty_set_operations(nslink_driver, &nslink_ops);
+ retval = tty_register_driver(nslink_driver);
+ if (retval < 0) {
+ printk(KERN_INFO "Couldn't install tty NS-Link driver (error %d)\n", -retval);
+- put_tty_driver(nslink_driver);
++ tty_driver_kref_put(nslink_driver);
+ return retval;
+ }
+ driver_registered = 1;
+ printk(KERN_INFO "NS-Link driver is major %d\n", nslink_driver->major);
+ return 0;
+@@ -5737,11 +5737,11 @@ static void nrp_cleanup_module(void)
+ for (i = 0; i < numBoxes; i++)
+ free_si_box(i);
+
+ if (driver_registered) {
+ tty_unregister_driver(nslink_driver);
+- put_tty_driver(nslink_driver);
++ tty_driver_kref_put(nslink_driver);
+ }
+
+ printk(KERN_INFO "nslink: finished driver module shutdown\n");
+ return;
+ }
diff --git a/0007-service-priority.patch b/0007-service-priority.patch
new file mode 100644
index 000000000000..a0d5c4269fcc
--- /dev/null
+++ b/0007-service-priority.patch
@@ -0,0 +1,30 @@
+diff -pNaru5 a/nslink.service b/nslink.service
+--- a/nslink.service 2014-08-12 12:47:41.000000000 -0400
++++ b/nslink.service 2022-02-08 13:11:11.754490452 -0500
+@@ -4,10 +4,11 @@ Wants=network-online.target
+ After=network-online.target
+ After=syslog.target
+
+ [Service]
+
++Nice=-10
+ Type=forking
+ PIDFile=/var/run/nslinkd.pid
+ ExecStartPre=/sbin/modprobe nslink
+ ExecStart=/sbin/nslinkd
+ ExecStopPost=/sbin/rmmod nslink
+diff -pNaru5 a/nslink.service.run b/nslink.service.run
+--- a/nslink.service.run 2020-11-11 16:28:03.000000000 -0500
++++ b/nslink.service.run 2022-02-08 13:11:17.474526280 -0500
+@@ -4,10 +4,11 @@ Wants=network-online.target
+ After=network-online.target
+ After=syslog.target
+
+ [Service]
+
++Nice=-10
+ Type=forking
+ PIDFile=/run/nslinkd.pid
+ ExecStartPre=/sbin/modprobe nslink
+ ExecStart=/sbin/nslinkd
+ ExecStopPost=/sbin/rmmod nslink
diff --git a/0008-python3-firmware.patch b/0008-python3-firmware.patch
new file mode 100644
index 000000000000..85626947aa89
--- /dev/null
+++ b/0008-python3-firmware.patch
@@ -0,0 +1,199 @@
+diff -pNaru5 a/DM-Firmware-Updater.py b/DM-Firmware-Updater.py
+--- a/DM-Firmware-Updater.py 2022-09-25 23:06:30.913939525 -0400
++++ b/DM-Firmware-Updater.py 2022-09-25 23:07:09.284353072 -0400
+@@ -11,21 +11,23 @@ def getVersionString(s):
+ resp = s.recv(1024)
+ fmt = ">LLLLLL64s6sLBBHBBBB"
+ devIpAddr, defRoute, srvIpAddr, ipMask, availMemAddr, availMemLength, version, macAddr, \
+ modelId, archId, numPorts, progId, boardRev, bootRevMajor, bootRevMinor, numApps \
+ = struct.unpack(fmt,resp[:struct.calcsize(fmt)])
++ if sys.hexversion >= 0x030000F0:
++ version=version.decode() # byte array to string array
+ return version[:version.index('\x00')]
+
+-def getArch((host,port),useIPv6=0):
++def getArch(hostport,useIPv6=0):
+
+ if useIPv6:
+ s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
+ else:
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ s.settimeout(15)
+ try:
+- s.connect((host,port))
++ s.connect(hostport)
+ except socket.timeout:
+ return "network connection timeout";
+ except (OSError, socket.error) as e:
+ return "Error opening connection: " + str(e)
+
+@@ -40,26 +42,31 @@ def getArch((host,port),useIPv6=0):
+ except socket.timeout:
+ return "network connection timeout";
+ except (OSError, socket.error) as e:
+ return "error requesting device ID info: " + str(e)
+
+- return ord(resp[98])
++ if sys.hexversion >= 0x030000F0:
++ #print(resp[98]) # 3 for me
++ return resp[98] # python3 byte array
++ else:
++ #print(ord(resp[98])) # 3 for me
++ return ord(resp[98]) # python2 str array
+
+
+ # return error message if failure otherwise return None
+-def uploadFile((host,port),filedata,doreset,callback,useIPv6=0):
++def uploadFile(hostport,filedata,doreset,callback,useIPv6=0):
+ filesize = len(filedata)
+
+ if doreset:
+ if useIPv6:
+ s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
+ else:
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ callback(0,"opening connection")
+ s.settimeout(15)
+ try:
+- s.connect((host,port))
++ s.connect(hostport)
+ except socket.timeout:
+ return("network connection timeout");
+ except (OSError, socket.error) as e:
+ return "Error opening connection: " + str(e)
+ callback(0,"sending reset command")
+@@ -69,11 +76,11 @@ def uploadFile((host,port),filedata,dore
+ except socket.timeout:
+ return("timeout sending reset command");
+ except (OSError, socket.error) as e:
+ return "Error sending reset command: " + str(e)
+ # wait 3 seconds for the unit to reset and come back up
+- for i in xrange(6):
++ for i in range(6):
+ time.sleep(0.5)
+ callback((filesize*i)/6)
+ callback(filesize)
+
+ if useIPv6:
+@@ -81,11 +88,11 @@ def uploadFile((host,port),filedata,dore
+ else:
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ callback(0,"opening connection")
+ s.settimeout(15)
+ try:
+- s.connect((host,port))
++ s.connect(hostport)
+ except socket.timeout:
+ return("Timeout opening connection");
+ except (OSError, socket.error) as e:
+ return "Error opening connection: " + str(e)
+
+@@ -126,10 +133,11 @@ def uploadFile((host,port),filedata,dore
+
+ if sys.hexversion >= 0x030000F0:
+ from tkinter import *
+ from tkinter.ttk import *
+ import tkinter.filedialog as filedialog
++ import tkinter.messagebox as messagebox
+ else:
+ from Tkinter import *
+ from ttk import *
+ import tkFileDialog as filedialog
+ import tkMessageBox as messagebox
+diff -pNaru5 a/dmupdate.py b/dmupdate.py
+--- a/dmupdate.py 2022-09-25 23:06:30.923939633 -0400
++++ b/dmupdate.py 2022-09-25 23:06:33.043962526 -0400
+@@ -77,11 +77,11 @@ def getIdentReply(s):
+ s.send(struct.pack("<BBHL",cmd,index,length,addr))
+ resp = s.recv(1024)
+ signal.alarm(0)
+
+ if verbose>1:
+- print "[%d] %s" % (len(resp),toHex(resp))
++ print("[%d] %s" % (len(resp),toHex(resp)))
+
+ return resp
+
+ def getArch(hostName):
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+@@ -137,33 +137,33 @@ def isRedBoot(s,verbose=False):
+ edata = remaining[:elen]
+ remaining = remaining[elen:]
+ extData.append((etype,elen,edata))
+
+ if verbose:
+- print "%15s: %s" % ("devIpAddr",fmtIP(devIpAddr))
+- print "%15s: %s" % ("defRoute",fmtIP(defRoute))
+- print "%15s: %s" % ("srvIpAddr",fmtIP(srvIpAddr))
+- print "%15s: %s" % ("ipMask",fmtIP(ipMask))
+- print "%15s: %s" % ("availMemAddr",hex(availMemAddr))
+- print "%15s: %s" % ("availMemLength",hex(availMemLength))
++ print("%15s: %s" % ("devIpAddr",fmtIP(devIpAddr)))
++ print("%15s: %s" % ("defRoute",fmtIP(defRoute)))
++ print("%15s: %s" % ("srvIpAddr",fmtIP(srvIpAddr)))
++ print("%15s: %s" % ("ipMask",fmtIP(ipMask)))
++ print("%15s: %s" % ("availMemAddr",hex(availMemAddr)))
++ print("%15s: %s" % ("availMemLength",hex(availMemLength)))
+ if verbose>1:
+- print "%15s: %s" % ("version",repr(version))
++ print("%15s: %s" % ("version",repr(version)))
+ else:
+- print "%15s: %s" % ("version",version[:version.index('\x00')]) # ignore trailing NULs
+- print "%15s: %s" % ("macAddr", macToStr(macAddr))
+- print "%15s: %s" % ("modelId",modelId)
+- print "%15s: %s" % ("archId",archId)
+- print "%15s: %s" % ("numPorts",numPorts)
+- print "%15s: %s" % ("progId",progId)
+- print "%15s: %s" % ("boardRev",boardRev)
+- print "%15s: %s" % ("bootRevMajor",bootRevMajor)
+- print "%15s: %s" % ("bootRevMinor",bootRevMinor)
+- print "%15s: %s" % ("numApps",numApps)
+- print "%15s: %s" % ("appRecords",appRecords)
+- print "%15s: %s" % ("numUserBytes",numUserBytes)
+- print "%15s: %s" % ("appEnables",hex(appEnables))
+- print "%15s:" % ("extData:")
++ print("%15s: %s" % ("version",version[:version.index('\x00')])) # ignore trailing NULs
++ print("%15s: %s" % ("macAddr", macToStr(macAddr)))
++ print("%15s: %s" % ("modelId",modelId))
++ print("%15s: %s" % ("archId",archId))
++ print("%15s: %s" % ("numPorts",numPorts))
++ print("%15s: %s" % ("progId",progId))
++ print("%15s: %s" % ("boardRev",boardRev))
++ print("%15s: %s" % ("bootRevMajor",bootRevMajor))
++ print("%15s: %s" % ("bootRevMinor",bootRevMinor))
++ print("%15s: %s" % ("numApps",numApps))
++ print("%15s: %s" % ("appRecords",appRecords))
++ print("%15s: %s" % ("numUserBytes",numUserBytes))
++ print("%15s: %s" % ("appEnables",hex(appEnables)))
++ print("%15s:" % ("extData:"))
+ for e in extData:
+ descr = " type:%d len:%d data: %s" % (e[0],e[1],toHex(e[2]))
+ if e[0] == 2:
+ descr += " -- " + decodeFeatureBits(ord(e[2][0]))
+ elif e[0] == 3:
+@@ -172,11 +172,11 @@ def isRedBoot(s,verbose=False):
+ descr += " -- ipv6 mode"
+ elif e[0] == 5:
+ descr += " -- ipv4 configured address"
+ elif e[0] == 6:
+ descr += " -- ipv6 current address"
+- print descr
++ print(descr)
+
+ return version.startswith("Bootloader") and (progId == 0)
+
+
+ def downloadFile(hostName,fileobj,go=0,quiet=0,skip=0,base=0,entry=None,verify_redboot=0):
+@@ -188,11 +188,11 @@ def downloadFile(hostName,fileobj,go=0,q
+ isrb = isRedBoot(s,verbose)
+
+ alarm(0)
+
+ if verify_redboot and not isrb:
+- print "Failed to re-connect to RedBoot, found running application."
++ print("Failed to re-connect to RedBoot, found running application.")
+ sys.exit(1)
+
+ bytecount = len(fileobj.read(skip))
+ index = 0
+ while 1:
diff --git a/0009-python3-nslink.patch b/0009-python3-nslink.patch
new file mode 100644
index 000000000000..9c33369bbd24
--- /dev/null
+++ b/0009-python3-nslink.patch
@@ -0,0 +1,45 @@
+diff -pNaru5 a/nslinkrelease.py b/nslinkrelease.py
+--- a/nslinkrelease.py 2008-04-17 09:58:04.000000000 -0400
++++ b/nslinkrelease.py 2022-09-25 21:07:39.447831425 -0400
+@@ -1,13 +1,13 @@
+-#!/usr/local/bin/python
++#!/usr/bin/python
+ # needs Python 2.0 or newer
+ import sys
+ import os,stat,fcntl
+ import socket,select
+ import struct
+ import re
+-import commands
++import subprocess
+
+ def toHex(s):
+ return " ".join([("%02x" % ord(c)) for c in s])
+
+ def lookupMajor(driverName):
+@@ -67,11 +67,11 @@ def devRelease(devName):
+ s = os.stat(devName)
+ if not stat.S_ISCHR(s[stat.ST_MODE]):
+ msg = "devRelease: '%s' is not char device" % devName
+ raise msg
+ # os.stat() dosn't return the dev type, so use /usr/sbin/stat
+- s,o = commands.getstatusoutput("stat "+devName)
++ s,o = subprocess.getstatusoutput("stat "+devName)
+ if s:
+ msg = "devRelease: error running /usr/bin/stat: %d" % s
+ raise msg
+ r = re.compile("Device type: ([0-9]{1,3}),([0-9]{1,3})")
+ m = r.search(o)
+@@ -81,11 +81,11 @@ def devRelease(devName):
+ minor = int(m.group(2))
+ if major != lookupMajor("ttySI"):
+ raise "not nslink device"
+ ctlmajor = lookupMajor("NSLinkctl")
+ t = os.tempnam(None,".nslnkctl")
+- s,o = commands.getstatusoutput("mknod --mode=600 %s c %d %d" % (t,ctlmajor,0))
++ s,o = subprocess.getstatusoutput("mknod --mode=600 %s c %d %d" % (t,ctlmajor,0))
+ if s:
+ msg = "error running mknod : %s" % o
+ raise msg
+ fd = os.open(t,os.O_RDONLY)
+ os.unlink(t)
diff --git a/0010-kernel-6.1-TTY_DRIVER_MAGIC-remove-dead-code.patch b/0010-kernel-6.1-TTY_DRIVER_MAGIC-remove-dead-code.patch
new file mode 100644
index 000000000000..799cb088e745
--- /dev/null
+++ b/0010-kernel-6.1-TTY_DRIVER_MAGIC-remove-dead-code.patch
@@ -0,0 +1,15 @@
+diff -pNaru5 a/nslink.c b/nslink.c
+--- a/nslink.c 2023-01-03 02:12:34.380355007 -0500
++++ b/nslink.c 2023-01-03 02:12:46.210343269 -0500
+@@ -5636,11 +5636,10 @@ int register_tty_driver(tBoxPortCount *u
+
+ // Set up the tty driver structure and then register this
+ // driver with the tty layer.
+ nslink_driver = tty_alloc_driver((MAX_NRP_TOTAL_PORTS - 1),0);
+
+- nslink_driver->magic = TTY_DRIVER_MAGIC;
+ nslink_driver->driver_name = "NS-Link";
+ nslink_driver->name = "ttySI";
+ nslink_driver->num = bp.portCount;
+ nslink_driver->major = 0; // dynamically allocated major number
+ nslink_driver->minor_start = 0;
diff --git a/0011-kernel-6.0-set_termios-const-ktermios.patch b/0011-kernel-6.0-set_termios-const-ktermios.patch
new file mode 100644
index 000000000000..7421f9cc6efa
--- /dev/null
+++ b/0011-kernel-6.0-set_termios-const-ktermios.patch
@@ -0,0 +1,19 @@
+diff -pNaru5 a/nslink.c b/nslink.c
+--- a/nslink.c 2023-01-03 02:18:37.770057769 -0500
++++ b/nslink.c 2023-01-03 02:19:36.499474484 -0500
+@@ -3043,11 +3043,15 @@ static void nrp_close(struct tty_struct
+ DebugOpen("ttySI%d (count=%d) enter\n", info->line, info->port.count);
+ tty_port_close(&info->port, tty, filp);
+ DebugOpen("ttySI%d (count=%d) return\n", info->line, info->port.count);
+ }
+
++#if LINUX_VERSION_CODE < VERSION_CODE(6,0,0)
+ static void nrp_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
++#else
++static void nrp_set_termios(struct tty_struct *tty, const struct ktermios *old_termios)
++#endif
+ {
+ struct nr_port *info = (struct nr_port *) tty->driver_data;
+ unsigned cflag;
+ #if LINUX_VERSION_CODE >= VERSION_CODE(3,7,0)
+ struct ktermios *termios = &tty->termios;
diff --git a/0012-kernel-6.6-struct-tty_operations-write-size_t.patch b/0012-kernel-6.6-struct-tty_operations-write-size_t.patch
new file mode 100644
index 000000000000..9c3160411348
--- /dev/null
+++ b/0012-kernel-6.6-struct-tty_operations-write-size_t.patch
@@ -0,0 +1,19 @@
+diff -pNaru5 a/nslink.c b/nslink.c
+--- a/nslink.c 2023-12-18 23:12:28.169040957 -0500
++++ b/nslink.c 2023-12-18 23:12:57.762981307 -0500
+@@ -3745,11 +3745,15 @@ static void nrp_flush_chars(struct tty_s
+ * Our open source friends changed the tty layer in kernel version 2.6.10, removing
+ * the from_user parameter, presumable the memcpy() functions now can deal with
+ * copies to/from user space. There is therefore 2 versions of the following function.
+ */
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(6,6,0)
+ static int nrp_write(struct tty_struct *tty, const unsigned char *buf, int count)
++#else
++static ssize_t nrp_write(struct tty_struct *tty, const unsigned char *buf, size_t count)
++#endif
+ {
+ struct nr_port *info = (struct nr_port *) tty->driver_data;
+ int c, retval = 0;
+ unsigned long flags;
+
diff --git a/0013-kernel-6.3-tty_port_operations-int-to-bool.patch b/0013-kernel-6.3-tty_port_operations-int-to-bool.patch
new file mode 100644
index 000000000000..2c0e32fac64b
--- /dev/null
+++ b/0013-kernel-6.3-tty_port_operations-int-to-bool.patch
@@ -0,0 +1,35 @@
+diff -pNaru5 a/nslink.c b/nslink.c
+--- a/nslink.c 2023-12-18 23:19:31.601965492 -0500
++++ b/nslink.c 2023-12-18 23:19:42.605279547 -0500
+@@ -2812,11 +2812,15 @@ static void configure_nr_port(struct nr_
+ if (info->si->use_tcp == 0)
+ si_timer((callback_param_type)&info->si->timer);
+ }
+ }
+
++#if LINUX_VERSION_CODE < VERSION_CODE(6,3,0)
+ static int nrp_port_carrier_raised(struct tty_port *port)
++#else
++static bool nrp_port_carrier_raised(struct tty_port *port)
++#endif
+ {
+ struct nr_port *info = container_of(port, struct nr_port, port);
+ unsigned msr = info->si->port_state[info->portnum].modemStatusRegister;
+ return (msr & MSR_CD_ON) ? 1 : 0;
+ }
+@@ -2828,11 +2832,15 @@ static void send_commands(struct nr_port
+ si_timer((callback_param_type)&info->si->timer);
+ else
+ tcp_send_remote_cmds(info->si);
+ }
+
++#if LINUX_VERSION_CODE < VERSION_CODE(6,3,0)
+ static void nrp_port_dtr_rts(struct tty_port *port, int on)
++#else
++static void nrp_port_dtr_rts(struct tty_port *port, bool on)
++#endif
+ {
+ struct nr_port *info = container_of(port, struct nr_port, port);
+
+ if ((info->si->rsmode[info->portnum] == SI_RSMODE_485) ||
+ (info->si->rsmode[info->portnum] == SI_RSMODE_485FDS))
diff --git a/PKGBUILD b/PKGBUILD
index 66759d446151..7a7211f37f68 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,12 +3,15 @@
_opt_DKMS=1 # This can be toggled between installs
_opt_defaultmode='660' # default: 620
+#export KERNELRELEASE="$(basename $(dirname /usr/lib/modules/5.10.*/modules.alias))"
+
# Todo: Test secure mode
# Todo: python tools should be updated to python3
# Todo: nslinktool Config Driver needs an up down button to reorder entries
# Todo: TUI firmware updater.
# Todo: Firmware updater can't update unit set to DHCP.
+# Todo: Firmware updater errors out on old versions: Expected to connect to bootloader after reboot but found DeviceMaster Boot Version 1.20
# Todo: Comtrol icons for nslinktool and the firmware updater
# Todo: nslinktool set the mouse pointer to a spinning circle far too long after startup
# Todo: rm /dev/ttySI* on rmmod nslink
@@ -23,15 +26,15 @@ _opt_defaultmode='660' # default: 620
set -u
pkgname='nslink'
-pkgver='7.34'
-pkgrel='1'
+pkgver='8.00'
+pkgrel='7'
pkgdesc='tty driver and firmware update for Comtrol DeviceMaster, RTS, LT, PRO, 500, UP, RPSH-SI, RPSH, and Serial port Hub console terminal device server'
# UP is not explicitly supported by NS-Link, only by the firmware updater.
_pkgdescshort="Comtrol DeviceMaster ${pkgname} TTY driver"
arch=('i686' 'x86_64')
url='http://www.comtrol.com/'
license=('GPL')
-depends=('glibc' 'openssl' 'python2' 'sed' 'groff' 'tcl' 'tk' 'util-linux') # python is also needed for the firmware updater
+depends=('glibc' 'openssl' 'python3' 'sed' 'groff' 'tcl' 'tk' 'util-linux') # python is also needed for the firmware updater
optdepends=(
'gksu: NS-Link Manager GUI'
)
@@ -43,15 +46,53 @@ _srcdir="devicemaster-linux-${pkgver}"
_srcdir2='DM-Firmware-Updater-1.06' # http://downloads.comtrol.com/html/DM_PRO_RTS_SERIALHUB_pvdx2.htm
source=(
#"ftp://ftp.comtrol.com/dev_mstr/rts/drivers/linux/devicemaster-linux-${pkgver}.tar.gz"
- #"http://downloads.comtrol.com/dev_mstr/rts/drivers/linux/devicemaster-linux-${pkgver}.tar.gz"
- "http://downloads.comtrol.com/beta/dev_mstr/rts/drivers/linux/devicemaster-linux-${pkgver}.tar.gz"
+ "https://downloads.comtrol.com/dev_mstr/rts/drivers/linux/devicemaster-linux-${pkgver}.tar.gz"
#'ftp://ftp.comtrol.com/dev_mstr/rts/utility/linux_firmware_uploader/DM-Firmware-Updater-1.06.tar.gz'
- 'http://downloads.comtrol.com/dev_mstr/rts/utility/linux_firmware_uploader/DM-Firmware-Updater-1.06.tar.gz'
+ 'https://downloads.comtrol.com/dev_mstr/rts/utility/linux_firmware_uploader/DM-Firmware-Updater-1.06.tar.gz'
'dmupdate.py.usage.patch'
+ '0002-kernel-5.6-proc_dir_entry-proc_ops.patch'
+ '0003-tty_unregister_driver-void.patch'
+ '0004-kernel-5.12-tty-low_latency.patch'
+ '0005-kernel-5.14-unsigned-tty-flow-tty.patch'
+ '0006-kernel-5.15-alloc_tty_driver-put_tty_driver.patch'
+ '0007-service-priority.patch'
+ '0008-python3-firmware.patch'
+ '0009-python3-nslink.patch'
+ '0010-kernel-6.1-TTY_DRIVER_MAGIC-remove-dead-code.patch'
+ '0011-kernel-6.0-set_termios-const-ktermios.patch'
+ '0012-kernel-6.6-struct-tty_operations-write-size_t.patch'
+ '0013-kernel-6.3-tty_port_operations-int-to-bool.patch'
)
-sha256sums=('4434d75078db4c4d8406fc3013bd76dbac2d11133062de9ee1cfff4db533773b'
+md5sums=('b59906d80268e69a24c211b398ffd10c'
+ 'e3ffb36acfdd321c919e44d477f0774a'
+ '581cd5f582ed20c7cf85a4df23a9f78a'
+ '36fcfa504772df4aabbde9f23d5459d5'
+ '7e0659716e30c6e2ff5c16f20aac07be'
+ '4e0c61dc0c5da4c3125db7ac1e481aac'
+ '93e85c98fd375285887b78f2df44ce01'
+ 'f85645dfe886b57273b475d3c6cd0964'
+ 'e5692035f047cdec52658f67954c6f4d'
+ '8c329cf0f9c90cfd07ba86a4027eec48'
+ 'e21d8211b2f209ace648340cb5583805'
+ '2774e3aa64717a7613e96fd86f649ea1'
+ '98788ff1378604e9fda43eb6ef9e9e3d'
+ 'feb1ccc7522a6ac2b33326c7f648edb2'
+ '1ff77ae8edbcd654c680999eadd4911b')
+sha256sums=('092859a3c198f8e3f5083a752eab0af74ef71dce59ed503d120792be13cc5fa3'
'd21c5eeefdbf08a202a230454f0bf702221686ba3e663eb41852719bb20b75fb'
- '5a4e2713a8d1fe0eebd94fc843839ce5daa647f9fa7d88f62507e660ae111073')
+ '5a4e2713a8d1fe0eebd94fc843839ce5daa647f9fa7d88f62507e660ae111073'
+ 'cbaa55f16357688b992a7d7c0f2fb56225edda286d97595918c50e05005d1318'
+ '7b7718789a4a23c3f16094f93b9fc0d8a5915e67e6a0aedef17cdb6adb22a1ac'
+ 'a48cdf948f907b00919c3a2dadbaa2c41c28891d689195e072765c39b0b4af49'
+ '12c55d7b898b5cdcd09d6927fef1585a702fde356e8e039e7e85bbce64f3eed8'
+ '364a4fb9d8695067ee8d235d7763c59f6df417937b901a1810e00d397db21aee'
+ 'bfa34783131c52e0bc0645c76469aaf504b13ac16d57b02d5ea9002603fb583e'
+ '1353bc403b56ef0b00f4b87826991812ee24bcc9a0b2612c0027317a7aa86736'
+ 'a84e1a9884580917afe55816b4ec9b44ec0f4977144e7f4325647ff58642ecd6'
+ '2b909997f0662ae9a49463be4c1ef2af718882924071e0d74b9c04d9d1198691'
+ '7f181d1542b542989b319caf85621725389d7681cf2d5c3bb57dc774d14f1b76'
+ '5a62d3658d716c8140de65c2ac2e2560ca33f0f2a58212e29df74eadb821b6ce'
+ '4c605df9b08ea2be3b3c94a2dab8554902ff15576a7075c597453306c275e3e2')
if [ "${_opt_DKMS}" -ne 0 ]; then
depends+=('linux' 'dkms' 'linux-headers')
@@ -77,6 +118,60 @@ prepare() {
fi
unset _ver
+ #cp -p nslink.c{,.orig}; false
+ #diff -pNau5 nslink.c{.orig,} > '0002-kernel-5.6-proc_dir_entry-proc_ops.patch'
+ #patch -Nup0 -i "${srcdir}/0002-kernel-5.6-proc_dir_entry-proc_ops.patch"
+
+ #cp -p nslink.c{,.orig}; false
+ #diff -pNau5 nslink.c{.orig,} > '0003-tty_unregister_driver-void.patch'
+ patch -Nup0 -i "${srcdir}/0003-tty_unregister_driver-void.patch"
+
+ #cp -p nslink.c{,.orig}; false
+ #diff -pNau5 nslink.c{.orig,} > '0004-kernel-5.12-tty-low_latency.patch'
+ patch -Nup0 -i "${srcdir}/0004-kernel-5.12-tty-low_latency.patch"
+
+ # tty.stopped https://lore.kernel.org/lkml/20210505091928.22010-13-jslaby@suse.cz/
+ # unsigned write_room https://www.spinics.net/lists/linux-serial/msg42297.html
+ # unsigned chars_in_buffer https://www.spinics.net/lists/linux-serial/msg42299.html
+ #cp -p nslink.c{,.orig}; false
+ #diff -pNau5 nslink.c{.orig,} > '0005-kernel-5.14-unsigned-tty-flow-tty.patch'
+ patch -Nup0 -i "${srcdir}/0005-kernel-5.14-unsigned-tty-flow-tty.patch"
+
+ # http://lkml.iu.edu/hypermail/linux/kernel/2107.2/08799.html [PATCH 5/8] tty: drop alloc_tty_driver
+ # http://lkml.iu.edu/hypermail/linux/kernel/2107.2/08801.html [PATCH 7/8] tty: drop put_tty_driver
+ #rm -f *.orig; cp -p nslink.c{,.orig}; false
+ #diff -pNau5 nslink.c{.orig,} > '0006-kernel-5.15-alloc_tty_driver-put_tty_driver.patch'
+ patch -Nup0 -i "${srcdir}/0006-kernel-5.15-alloc_tty_driver-put_tty_driver.patch"
+
+ #rm -f *.orig; cp -p nslink.service{,.orig}; false
+ #diff -pNau5 nslink.service{.orig,} > '0007-service-priority.patch'
+ #patch -Nup0 -i "${srcdir}/0007-service-priority.patch"
+
+ #rm -f *.orig; cd '..'; cp -pr "${_srcdir}" 'a'; ln -s "${_srcdir}" 'b'; false
+ # diff -pNaru5 'a' 'b' > '0007-service-priority.patch'
+ patch -Nup1 -i "${srcdir}/0007-service-priority.patch"
+
+ #rm -f *.orig; cd '..'; cp -pr "${_srcdir}" 'a'; ln -s "${_srcdir}" 'b'; false
+ # diff -pNaru5 'a' 'b' > '0009-python3-nslink.patch'
+ patch -Nup1 -i "${srcdir}/0009-python3-nslink.patch"
+
+ #cd '..'; cp -pr "${_srcdir}" 'a'; ln -s "${_srcdir}" 'b'; false
+ # diff -pNaru5 'a' 'b' > '0010-kernel-6.1-TTY_DRIVER_MAGIC-remove-dead-code.patch'
+ patch -Nup1 -i "${srcdir}/0010-kernel-6.1-TTY_DRIVER_MAGIC-remove-dead-code.patch"
+
+ # https://lore.kernel.org/linux-arm-kernel/20220816115739.10928-9-ilpo.jarvinen@linux.intel.com/T/
+ #cd '..'; cp -pr "${_srcdir}" 'a'; ln -s "${_srcdir}" 'b'; false
+ # diff -pNaru5 'a' 'b' > '0011-kernel-6.0-set_termios-const-ktermios.patch'
+ patch -Nup1 -i "${srcdir}/0011-kernel-6.0-set_termios-const-ktermios.patch"
+
+ #cd '..'; cp -pr "${_srcdir}" 'a'; ln -s "${_srcdir}" 'b'; false
+ # diff -pNaru5 'a' 'b' > '0012-kernel-6.6-struct-tty_operations-write-size_t.patch'
+ patch -Nup1 -i "${srcdir}/0012-kernel-6.6-struct-tty_operations-write-size_t.patch"
+
+ #cd '..'; cp -pr "${_srcdir}" 'a'; ln -s "${_srcdir}" 'b'; false
+ # diff -pNaru5 'a' 'b' > '0013-kernel-6.3-tty_port_operations-int-to-bool.patch'
+ patch -Nup1 -i "${srcdir}/0013-kernel-6.3-tty_port_operations-int-to-bool.patch"
+
# Make package compatible
#cp -p 'install.sh' 'install.sh.Arch' # testmode for diff comparison
sed -e '# Fix some paths' \
@@ -102,10 +197,13 @@ prepare() {
-i 'install.sh'
test ! -s 'install.sh.Arch' || echo "${}"
+ # Fix /var/run
+ sed -e 's:/var/run/:/run/:g' -i 'nslink.service'
+
# Switch to python2
sed -e '# Why using local on just this one?' \
- -e 's:/usr/local/bin/python:/usr/bin/python:g' \
- -e 's:/usr/bin/python:&2:g' \
+ -e '#s:/usr/local/bin/python:/usr/bin/python:g' \
+ -e '#s:/usr/bin/python:&2:g' \
-i *.py 'nslinktool'
# Branding in dmesg
@@ -122,7 +220,19 @@ prepare() {
sed -e 's:^[^#]:#&:g' -i 'nslink.conf'
# Fix makefile
- sed -e 's:=/lib/modules:=/usr/lib/modules:g' -i 'Makefile'
+ #cp -p 'Makefile'{,.Arch}
+ sed -e 's:=/lib/modules:=/usr/lib/modules:g' \
+ -e '# Switch SUBDIRS= to M= for Kernel 5.4' \
+ -e 's:SUBDIRS=:M=:g' \
+ -e '# No DKMS instructions say to do this but it works and keeps the MAKE line real simple' \
+ -e 's:$(shell uname -r):$(KERNELRELEASE):g' \
+ -e 's:`uname -r`:$(KERNELRELEASE):g' \
+ -e '#s:$(KVER):$(KERNELRELEASE):g' \
+ -e '# Shift make executable to separate target' \
+ -e 's@^\tmake nslinkd@\nnslink:\n&@g' \
+ -e '1i KERNELRELEASE?=$(shell uname -r)' \
+ -i 'Makefile'
+ test ! -s 'Makefile.Arch'
# Correct group and chmod for serial
sed -e '/getgrnam/ s:"tty":"uucp":g' \
@@ -141,12 +251,16 @@ prepare() {
sed -e '# Cosmetic cleanup for simpler patch editing, trim space at eol' \
-e 's:\s\+$::g' \
-e '# Switch to python2' \
- -e 's:/usr/bin/python:&2:g' \
+ -e '#s:/usr/bin/python:&2:g' \
-i *.py
+ #rm -f *.orig; cd '..'; cp -pr 'DM-Firmware-Updater-1.06' 'a'; ln -s 'DM-Firmware-Updater-1.06' 'b'; false
+ #diff -pNaru5 'a' 'b' > '0008-python3-firmware.patch'
+ patch -Nup1 -i "${srcdir}/0008-python3-firmware.patch"
+
# Patch usage and help into command line tool
#diff -pNau5 dmupdate.py{.orig,} > '../dmupdate.py.usage.patch'
- patch -Nbup0 -i "${srcdir}/dmupdate.py.usage.patch"
+ patch -Nup0 -i "${srcdir}/dmupdate.py.usage.patch"
set +u
}
@@ -154,7 +268,7 @@ build() {
set -u
cd "${_srcdir}"
set +u
- if ! make -s -j1 QUIET=0; then
+ if ! make -j1 QUIET=0 all nslink; then
warning 'a no such file or directory error means you need to reboot to load the updated kernel'
false
fi
@@ -231,13 +345,6 @@ EOF
) "${_dkms}/dkms.conf"
install -Dpm644 'nslink.h' 'nslink_int.h' 'version.h' 'nslink.c' 'Makefile' -t "${_dkms}"
#make -C "${_dkms}" clean
- sed -e '# No DKMS instructions say to do this but it works and keeps the MAKE line real simple' \
- -e 's:$(shell uname -r):$(KERNELRELEASE):g' \
- -e 's:`uname -r`:$(KERNELRELEASE):g' \
- -e 's:$(KVER):$(KERNELRELEASE):g' \
- -e '# Get rid of make lines so make all makes the module' \
- -e 's:^\s\+make\s:#&:g' \
- -i "${_dkms}/Makefile"
fi
# Install firmware updaters