def reset_usb_controller(self): if self.debug: Logging.warning("Resetting usb controller") operating_system = open("/etc/issue").read() if operating_system == 'Debian GNU/Linux 7 \\n \\l\n\n': subprocess.check_output(["sudo", "service", "udev", "restart"]) elif operating_system == "Raspbian GNU/Linux 7 \\n \\l\n\n": pass else: Logging.warning("OS does not support usb interface reset. Due to the instability issues with linux_gpib this could lead to problems.")
def reset_usb_controller(self): if self.debug: Logging.warning("Resetting usb controller") operating_system = open("/etc/issue").read() if operating_system == 'Debian GNU/Linux 7 \\n \\l\n\n': subprocess.check_output(["sudo", "service", "udev", "restart"]) elif operating_system == "Raspbian GNU/Linux 7 \\n \\l\n\n": pass else: Logging.warning( "OS does not support usb interface reset. Due to the instability issues with linux_gpib this could lead to problems." )
def read(self, len=512, calls=0): try: result = gpib.read(self.id, len).rstrip("\n") except gpib.GpibError, e: Logging.warning(str(e)) if str(e) == "read() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.": Logging.info("Last write didn't succeed. Resending...") self.reset() self.write(self.last_write) if calls == 2: Logging.error("Unrecoverable error. Please reboot") raw_input("Press ENTER when done.") exit(1) self.reset() result = self.read(calls=calls + 1)
def read(self, len=512, calls=0): try: result = gpib.read(self.id, len).rstrip("\n") except gpib.GpibError, e: Logging.warning(str(e)) if str( e ) == "read() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.": Logging.info("Last write didn't succeed. Resending...") self.reset() self.write(self.last_write) if calls == 2: Logging.error("Unrecoverable error. Please reboot") raw_input("Press ENTER when done.") exit(1) self.reset() result = self.read(calls=calls + 1)