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.
32 lines
1.2 KiB
32 lines
1.2 KiB
1 year ago
|
From 0a4e877f9dabf68e265e3d754d2a14217f0b0756 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 ++--
|
||
|
2 files changed, 2 insertions(+), 2 deletions(-)
|
||
|
delete mode 100644 .usbip-attach.swp
|
||
|
|
||
|
diff --git a/usbip-attach b/usbip-attach
|
||
|
index d64767a..3e4a5f4 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 | awk -F/ '/\/sys\/devices\// { print $NF }' | 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.41.0
|
||
|
|