# HG changeset patch # User jacobs # Date 1172264379 28800 # Node ID bc5b4fa57622357619641ac8b2b8fd11bc29f2dc # Parent 021a463305e1841919377b7a24bf6628ce8585cc 6525048 HAL doesn't completely detect MFP devices 6525102 lpadmin pauses creating local queues diff -r 021a463305e1 -r bc5b4fa57622 usr/src/cmd/hal/hald/solaris/devinfo_usb.c --- a/usr/src/cmd/hal/hald/solaris/devinfo_usb.c Fri Feb 23 12:51:12 2007 -0800 +++ b/usr/src/cmd/hal/hald/solaris/devinfo_usb.c Fri Feb 23 12:59:39 2007 -0800 @@ -57,20 +57,37 @@ devinfo_printer_prnio_get_prober }; +static gboolean +is_usb_node(di_node_t node) +{ + int rc; + char *s; + + /* + * USB device nodes will have "compatible" propety values that + * begins with "usb". + */ + rc = di_prop_lookup_strings(DDI_DEV_T_ANY, node, "compatible", &s); + while (rc-- > 0) { + if (strncmp(s, "usb", 3) == 0) { + return (TRUE); + } + s += (strlen(s) + 1); + } + + return (FALSE); +} + HalDevice * devinfo_usb_add(HalDevice *parent, di_node_t node, char *devfs_path, char *device_type) { HalDevice *d, *nd = NULL; char *s; - int *i, *vid; + int *i; char *driver_name, *binding_name; char if_devfs_path[HAL_PATH_MAX]; - /* - * we distinguish USB devices by presence of "usb-vendor-id" - * property. should USB devices have "device_type"? - */ - if (di_prop_lookup_ints(DDI_DEV_T_ANY, node, "usb-vendor-id", &vid) <= 0) { + if (is_usb_node(node) == FALSE) { return (NULL); } @@ -106,7 +123,7 @@ if ((driver_name != NULL) && (strcmp (driver_name, "scsa2usb") == 0)) { nd = devinfo_usb_scsa2usb_add (d, node, devfs_path); } else if ((driver_name != NULL) && - (strcmp (driver_name, "usbprn") == 0)) { + (strcmp (driver_name, "usbprn") == 0)) { nd = devinfo_usb_printer_add (d, node, devfs_path); } else { devinfo_add_enqueue (d, devfs_path, &devinfo_usb_handler); @@ -178,7 +195,7 @@ break; } di_devfs_path_free (*minor_path); - minor_path = NULL; + *minor_path = NULL; } di_devlink_fini (&devlink_hdl); } diff -r 021a463305e1 -r bc5b4fa57622 usr/src/cmd/print/scripts/lpadmin --- a/usr/src/cmd/print/scripts/lpadmin Fri Feb 23 12:51:12 2007 -0800 +++ b/usr/src/cmd/print/scripts/lpadmin Fri Feb 23 12:59:39 2007 -0800 @@ -257,19 +257,6 @@ ;; esac -if [[ -n "${server}" ]] ; then - # if we need a uri, find the "best" one. - if [[ -z "${uri}" ]] ; then - uri="ipp://${server}/printers/${rem_printer}" - ${LPSTAT} -p ${uri} >/dev/null 2>&1 - if [[ $? -ne 0 ]] ; then - uri="lpd://${server}/printers/${rem_printer}#Solaris" - fi - fi - # set the bsdaddr - bsdaddr="${server},${rem_printer},Solaris" -fi - # if there is a "device" or LP configuration, it's local if [[ -n "${device}" || -f /etc/lp/printers/${printer}/configuration || \ -f /etc/lp/classes/${printer} ]] ; then @@ -328,6 +315,17 @@ exit_code=$? fi elif [[ -z "${local}" ]] ; then + # if we need a uri, find the "best" one. + if [[ -z "${uri}" ]] ; then + uri="ipp://${server}/printers/${rem_printer}" + ${LPSTAT} -p ${uri} >/dev/null 2>&1 + if [[ $? -ne 0 ]] ; then + uri="lpd://${server}/printers/${rem_printer}#Solaris" + fi + fi + # set the bsdaddr + bsdaddr="${server},${rem_printer},Solaris" + if [[ -n "${printer}" ]] ; then ${LPSET} -n system \ -a "printer-uri-supported=${uri}" \