Esempio n. 1
0
    cups11 = utils.to_bool(sys_conf.get('configure', 'cups11', '0'))

    try:
        probed_devices = device.probeDevices(['usb', 'par'], filter={'fax-type': (operator.gt, 0)})
    except Error:
        sys.exit(CUPS_BACKEND_FAILED)

    good_devices = 0
    for uri in probed_devices:
        try:
            back_end, is_hp, bus, model, serial, dev_file, host, zc, port = \
                device.parseDeviceURI(uri)
        except Error:
            continue

        mq = device.queryModelByModel(model)

        if mq.get('fax-type', FAX_TYPE_NONE) in (FAX_TYPE_MARVELL,):
            # HP Fax 3
            if bus == 'usb':
                print('direct %s "HP Fax 3" "%s USB %s HP Fax HPLIP" "MFG:HP;MDL:Fax 3;DES:HP Fax 3;"' % \
                    (uri.replace("hp:", "hpfax:"), model.replace('_', ' '), serial))

            else: # par
                print('direct %s "HP Fax 3" "%s LPT HP Fax HPLIP" "MFG:HP;MDL:Fax 3;DES:HP Fax 3;"' % \
                    (uri.replace("hp:", "hpfax:"), model.replace('_', ' ')))

        elif mq.get('fax-type', FAX_TYPE_NONE) in (FAX_TYPE_SOAP,) or mq.get('fax-type', FAX_TYPE_NONE) in (FAX_TYPE_LEDMSOAP,):
            # HP Fax 2
            if bus == 'usb':
                print('direct %s "HP Fax 2" "%s USB %s HP Fax HPLIP" "MFG:HP;MDL:Fax 2;DES:HP Fax 2;"' % \
Esempio n. 2
0
        sys.exit(1)

    s = sep.lower()
    if s in ('lf', 'newline'):
        sep = '\n'
    elif s == 'cr':
        sep = '\r'
    elif s == 'crlf':
        sep = '\r\n'
    elif s == 'tab':
        sep = '\t'
    elif s == '=':
        log.stderr("error: Separator must not be '='.")
        sys.exit(1)

    data = device.queryModelByModel(norm_model)

    if not data:
        log.stderr("error: Model name '%s' not found." % norm_model)
        sys.exit(1)

    output = ''
    if all_keys:
        kk = list(data.keys())
        kk.sort()
        for k in kk:
            if not output:
                output = '%s=%s' % (k, data[k])
            else:
                output = sep.join([output, '%s=%s' % (k, data[k])])
Esempio n. 3
0
    try:
        probed_devices = device.probeDevices(
            ['usb', 'par'], filter={'fax-type': (operator.gt, 0)})
    except Error:
        sys.exit(CUPS_BACKEND_FAILED)

    good_devices = 0
    for uri in probed_devices:
        try:
            back_end, is_hp, bus, model, serial, dev_file, host, zc, port = \
                device.parseDeviceURI(uri)
        except Error:
            continue

        mq = device.queryModelByModel(model)

        if mq.get('fax-type', FAX_TYPE_NONE) in (FAX_TYPE_MARVELL, ):
            # HP Fax 3
            if bus == 'usb':
                print('direct %s "HP Fax 3" "%s USB %s HP Fax HPLIP" "MFG:HP;MDL:Fax 3;DES:HP Fax 3;"' % \
                    (uri.replace("hp:", "hpfax:"), model.replace('_', ' '), serial))

            else:  # par
                print('direct %s "HP Fax 3" "%s LPT HP Fax HPLIP" "MFG:HP;MDL:Fax 3;DES:HP Fax 3;"' % \
                    (uri.replace("hp:", "hpfax:"), model.replace('_', ' ')))

        elif mq.get('fax-type', FAX_TYPE_NONE) in (FAX_TYPE_SOAP, ) or mq.get(
                'fax-type', FAX_TYPE_NONE) in (FAX_TYPE_LEDMSOAP, ):
            # HP Fax 2
            if bus == 'usb':
Esempio n. 4
0
        sys.exit(1)

    s = sep.lower()
    if s in ('lf', 'newline'):
        sep = '\n'
    elif s == 'cr':
        sep = '\r'
    elif s == 'crlf':
        sep = '\r\n'
    elif s == 'tab':
        sep = '\t'
    elif s == '=':
        log.stderr("error: Separator must not be '='.")
        sys.exit(1)

    data = device.queryModelByModel(norm_model)

    if not data:
        log.stderr("error: Model name '%s' not found." % norm_model)
        sys.exit(1)

    output = ''
    if all_keys:
        kk = list(data.keys())
        kk.sort()
        for k in kk:
            if not output:
                output = '%s=%s' % (k, data[k])
            else:
                output = sep.join([output, '%s=%s' % (k, data[k])])