From 238e16f978606a2c2585990675f6d643f0fd28ce Mon Sep 17 00:00:00 2001 From: Paul Donald Date: Sun, 11 Feb 2024 04:13:53 +0100 Subject: [PATCH] p910nd: hotplug+init: include extra ieee1284 properties Apple and macOS GUI co-opts the mDNS note= param as "Location" Signed-off-by: Paul Donald (cherry picked from commit 4591a79fa29f5c46b7061860ac1f51adc848697f) --- net/p910nd/files/p910nd.hotplug | 14 +++++++++++--- net/p910nd/files/p910nd.init | 16 ++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/net/p910nd/files/p910nd.hotplug b/net/p910nd/files/p910nd.hotplug index ed9e97d0af..a1bf4cab9e 100644 --- a/net/p910nd/files/p910nd.hotplug +++ b/net/p910nd/files/p910nd.hotplug @@ -228,9 +228,11 @@ get_and_store_printer_info() { local CMD local CLS local DES + local DRV local CID local CMT local SN + local VER # Build array of /dev/usb/lpX character devices already configured @@ -249,7 +251,7 @@ get_and_store_printer_info() { [ $DEBUG ] && echo i:"$i" case $i in - MFG:* | MANUFACTURER:* ) + MFG:* | MANUFACTURER:* | MFR:* ) MFG=${i##*:};; MDL:* | MODEL:* ) MDL=${i##*:};; @@ -257,14 +259,18 @@ get_and_store_printer_info() { CMD=${i##*:};; CLS:* ) CLS=${i##*:};; - DES:* ) + DES:* | DESCRIPTION:* ) DES=${i##*:};; + DRV:* ) + DRV=${i##*:};; CID:* | COMPATIBLEID:* ) CID=${i##*:};; COMMENT:* ) CMT=${i##*:};; - SN:* ) + SN:* | SERIALNUMBER:* | SERN:* ) SN=${i##*:};; + VER:* ) + VER=${i##*:};; esac [ -n "$SN" ] || SN=$iSerialNumber @@ -288,7 +294,9 @@ get_and_store_printer_info() { [ -z "$(eval "$uqgddu_cmd".mdns_cid)" ] && [ -n "$CID" ] && eval "$uqsddu_cmd.mdns_cid='$CID'" [ -z "$(eval "$uqgddu_cmd".mdns_cls)" ] && [ -n "$CLS" ] && eval "$uqsddu_cmd.mdns_cls='$CLS'" [ -z "$(eval "$uqgddu_cmd".mdns_cmt)" ] && [ -n "$CMT" ] && eval "$uqsddu_cmd.mdns_cmt='$CMT'" + [ -z "$(eval "$uqgddu_cmd".mdns_drv)" ] && [ -n "$DRV" ] && eval "$uqsddu_cmd.mdns_drv='$DRV'" [ -z "$(eval "$uqgddu_cmd".mdns_sn)" ] && [ -n "$SN" ] && eval "$uqsddu_cmd.mdns_sn='$SN'" + [ -z "$(eval "$uqgddu_cmd".mdns_ver)" ] && [ -n "$VER" ] && eval "$uqsddu_cmd.mdns_ver='$VER'" # No previously configured device? Configure this instance. Set CHAR_DEV so we can send driver. [ $UCI_DEV_CFG_NUMBER -eq -1 ] && eval "$uqsddu_cmd.device=/dev/'$DEVNAME'" && CHAR_DEV=/dev/"$DEVNAME" diff --git a/net/p910nd/files/p910nd.init b/net/p910nd/files/p910nd.init index 921a595411..b8ce991590 100644 --- a/net/p910nd/files/p910nd.init +++ b/net/p910nd/files/p910nd.init @@ -54,6 +54,14 @@ start_p910nd() { config_get mdns_mfg "$section" mdns_mfg config_get mdns_mdl "$section" mdns_mdl config_get mdns_cmd "$section" mdns_cmd + # Optional parameters + config_get mdns_cid "$section" mdns_cid + config_get mdns_cls "$section" mdns_cls + config_get mdns_cmt "$section" mdns_cmt + config_get mdns_des "$section" mdns_des + config_get mdns_drv "$section" mdns_drv + config_get mdns_sn "$section" mdns_sn + config_get mdns_ver "$section" mdns_ver # Set initial arguments set -- "pdl-datastream" "tcp" "$((port+9100))" @@ -65,6 +73,14 @@ start_p910nd() { [ -n "$mdns_mfg" ] && set -- "$@" "usb_MFG=$mdns_mfg" [ -n "$mdns_mdl" ] && set -- "$@" "usb_MDL=$mdns_mdl" [ -n "$mdns_cmd" ] && set -- "$@" "usb_CMD=$mdns_cmd" + # Optional parameters + [ -n "$mdns_cid" ] && set -- "$@" "usb_CID=$mdns_cid" + [ -n "$mdns_cls" ] && set -- "$@" "usb_CLS=$mdns_cls" + [ -n "$mdns_cmt" ] && set -- "$@" "usb_CMT=$mdns_cmt" + [ -n "$mdns_des" ] && set -- "$@" "usb_DES=$mdns_des" + [ -n "$mdns_drv" ] && set -- "$@" "usb_DRV=$mdns_drv" + [ -n "$mdns_sn" ] && set -- "$@" "usb_SN=$mdns_sn" + [ -n "$mdns_ver" ] && set -- "$@" "usb_VER=$mdns_ver" # Call procd_add_mdns with the positional parameters procd_add_mdns "$@" -- 2.30.2