Ejemplo n.º 1
0
 def get_current_ctrl(self):
     """
     It gets the current control. It is only a wrapper of the setCtrl
     method of zCtrl; user can use directly that method
     """
     try:
         fd_num = os.open(self.cur_ctrl, os.O_RDONLY)
         bin_ctrl = os.read(fd_num, 512)
         os.close(fd_num)
     except:
         raise
     else:
         ctrl = ZioCtrl()
         ctrl.unpack_to_ctrl(bin_ctrl)
         return ctrl
Ejemplo n.º 2
0
    def read_ctrl(self):
        """
        If the control char device is open and it is readable, then it reads
        the control structure. Every time it internally store the control; it
        will be used as default when no control is provided
        """
        if self.__fdc == None or not self.is_ctrl_readable():
            return None
        # Read the control
        bin_ctrl = os.read(self.__fdc, 512)

        ctrl = ZioCtrl()
        self.lastctrl = ctrl
        ctrl.unpack_to_ctrl(bin_ctrl)
        return ctrl