p910nd: hotplug+init: include extra ieee1284 properties
authorPaul Donald <newtwen@gmail.com>
Sun, 11 Feb 2024 03:13:53 +0000 (04:13 +0100)
committerPaul Donald <newtwen@gmail.com>
Sun, 11 Feb 2024 18:36:56 +0000 (19:36 +0100)
Apple and macOS GUI co-opts the mDNS note= param as "Location"

Signed-off-by: Paul Donald <newtwen@gmail.com>
net/p910nd/files/p910nd.hotplug
net/p910nd/files/p910nd.init

index ed9e97d0af52710da65983d53b2a6f034e6cc83a..a1bf4cab9e46c099b448a7eae5b74ab2952bdf17 100644 (file)
@@ -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"
index 921a5954112382f5b3c36e524494da386fe6e056..b8ce9915907c2490bce17d5eb43e44809637b78c 100644 (file)
@@ -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 "$@"