--- timedate.py.orig 2019-11-05 17:45:41.227805964 +0100 +++ timedate.py 2019-12-01 18:55:51.646676875 +0100 @@ -39,11 +39,11 @@ from base import device, status, utils, pml, tui, module from prnt import cups -try: - from fax import faxdevice -except ImportError: - log.error("Unable to load fax services for HPLIP (required for hp-timedate). Exiting.") - sys.exit(1) +#try: +# from fax import faxdevice +#except ImportError: +# log.error("Unable to load fax services for HPLIP (required for hp-timedate). Exiting.") +# sys.exit(1) PML_ERROR_CODES = { @@ -69,15 +69,15 @@ opts, device_uri, printer_name, mode, ui_toolkit, lang = \ mod.parseStdOpts() - device_uri = mod.getDeviceUri(device_uri, printer_name, - filter={'fax-type': (operator.gt, 0)}, - back_end_filter=['hpfax']) + device_uri = mod.getDeviceUri(device_uri, printer_name) +# filter={'fax-type': (operator.gt, 0)}, +# back_end_filter=['hpfax']) if not device_uri: sys.exit(1) log.info("Using device : %s\n" % device_uri) try: - d = faxdevice.FaxDevice(device_uri, printer_name, disable_dbus=True) + d = device.Device(device_uri, printer_name, disable_dbus=True) except Error as e: if e.opt == ERROR_DEVICE_DOES_NOT_SUPPORT_OPERATION: log.error("Device does not support setting time/date.") --- base/device.py.orig 2019-11-04 11:48:05.000000000 +0100 +++ base/device.py 2019-12-02 12:04:09.674608657 +0100 @@ -2643,6 +2643,12 @@ return ok + def setDateAndTime(self): + t = time.localtime() + p = struct.pack('>BBBBBBB', t[0]-2000, t[1], t[2], t[6]+1, t[3], t[4], t[5]) + log.info(' to: '+time.strftime('%c',t)) + log.debug(repr(p)) + return self.setPML(pml.OID_DATE_AND_TIME, str(p.decode('latin-1')))