You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
xrdp-usb/SOURCES/0001-Update-matches.patch

31 lines
1.2 KiB

From 05a656ebeccd151e4c78eae3704fcd291d2263ae Mon Sep 17 00:00:00 2001
From: tigro <arkadiy.sheyn@softline.com>
Date: Mon, 9 Oct 2023 12:50:03 +0300
Subject: [PATCH] Update matches
---
usbip-attach | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/usbip-attach b/usbip-attach
index d64767a..5ae33cd 100755
--- a/usbip-attach
+++ b/usbip-attach
@@ -7,11 +7,11 @@
log_file="/var/log/usbip-attach"
usbip_program="/usr/sbin/usbip"
-host="$(journalctl -u xrdp-sesman | sed -n 's/^.*++ \(created\|reconnected\).* ip \([0-9.]*\):.*$/\2/p' | tail -1)"
+host="$(journalctl -u xrdp-sesman | grep -Po '(created|reconnected).*ip \K[^\s]*' | sed 's/\(.*\):/\1 /;s/::ffff://' | awk '{ print $1 }' | tail -1)"
echo "$(date) Connected from $host" >> $log_file
$usbip_program list -r "$host" 2>&1 >> $log_file
-$usbip_program list -r "$host" 2>/dev/null | sed -n 's/^ *\([0-9-]\+\):.*$/\1/p' | while read id;do
+$usbip_program list -r "$host" 2>/dev/null | sed -n 's/^ *\([0-9-].*[0-9]\+\): .*$/\1/p' | while read id;do
echo "Found exported USB device $id, try to attach..." >> $log_file
$usbip_program attach -r "$host" -b "$id" 2>&1 >> $log_file
done
--
2.43.0