Ejemplo n.º 1
0
    def __init__(self, path, name):
        """
        It calls the __init__ function from ZioObject for a generic
        initialization; then it looks for attributes, channels and trigger in
        its directory. Valid directory are channels except the 'trigger'
        directory; all valid files are attributes. The list of children object
        is made of trigger and channels.
        """
        ZioObject.__init__(self, path, name) # Initialize zObject
        self.chan = [] # List of channel children
        self.trigger = None # Associated trigger
        self.interleave = None # Interleaved channel

        for tmp in os.listdir(self.fullpath):
            if not self.is_valid_sysfs_element(tmp): # Skip if invalid element
                continue
            if tmp == "trigger" and isdir(join(self.fullpath, tmp)):
                self.trigger = ZioTrig(self.fullpath, tmp)
                continue

            if isdir(join(self.fullpath, tmp)): # Subdir is a channel
                newchan = ZioChan(self.fullpath, tmp)
                self.chan.append(newchan)
                if tmp == "chani":
                    self.interleave = newchan
            else: # otherwise is an attribute
                self.attribute[tmp] = ZioAttribute(self.fullpath, tmp)

        # Update the zObject children list
        self.obj_children.append(self.trigger)
        self.obj_children.extend(self.chan)
Ejemplo n.º 2
0
 def __init__(self, path, name):
     """
     It calls the __init__ function from zObject for a generic
     initialization; then it looks for attributes in its directory. All
     valid files within trigger directory are attributes.
     """
     ZioObject.__init__(self, path, name)
     for tmp in os.listdir(self.fullpath):
         if not self.is_valid_sysfs_element(tmp):
             continue
         self.attribute[tmp] = ZioAttribute(self.fullpath, tmp)
Ejemplo n.º 3
0
 def __init__(self, path, name):
     """
     It calls the __init__ function from ZioObject for a generic
     initialization; then it looks for attributes in its directory: all
     valid files within its directory are buffers's attributes
     """
     ZioObject.__init__(self, path, name)
     self.__flush_attr = None
     # Inspect all files and directory
     for tmp in os.listdir(self.fullpath):
         # Skip if the element it is not valid
         if not self.is_valid_sysfs_element(tmp):
             continue
         # All the valid element are attributes
         self.attribute[tmp] = ZioAttribute(self.fullpath, tmp)
Ejemplo n.º 4
0
    def __init__(self, path, name):
        """
        It calls the __init__ function from ZioObject for a generic
        initialization; then it looks for attributes and csets in its
        directory. All valid directory are csets, and all valid files are
        attributes. The list of object children is equal to the list of channel
        set.
        """
        ZioObject.__init__(self, path, name)
        self.cset = [] # List of children cset
        for tmp in os.listdir(self.fullpath):
            if not self.is_valid_sysfs_element(tmp): # Skip if invalid element
                continue
            if isdir(join(self.fullpath, tmp)): # Subdirs are csets
                newcset = ZioCset(self.fullpath, tmp)
                self.cset.append(newcset)
            else: # otherwise is an attribute
                self.attribute[tmp] = ZioAttribute(self.fullpath, tmp)

        self.obj_children.extend(self.cset) # Update the zObject children list
Ejemplo n.º 5
0
    def __init__(self, path, name):
        """
        It calls the __init__ function from ZioObject for a generic
        initialization; then it looks for attributes and buffer in its
        directory. All valid files are normal attributes. A directory can be a
        buffer or an interface.
        """
        ZioObject.__init__(self, path, name)
        self.cur_ctrl = None
        self.buffer = None
        self.interface_type = None

        # Inspect all files and directory
        for tmp in os.listdir(self.fullpath):
            # Skip if the element it is not valid
            if not self.is_valid_sysfs_element(tmp):
                continue
            # If the element is "buffer" then create a zBuf instance
            if tmp == "buffer" and isdir(join(self.fullpath, tmp)):
                self.buffer = ZioBuf(self.fullpath, tmp)
                continue
            if tmp == "current-control":
                self.cur_ctrl = join(self.fullpath, tmp)
                continue
            if tmp == "zio-cdev" and isdir(join(self.fullpath, tmp)):
                self.interface_type = "cdev" # Init later, we need attributes
                continue
            # Otherwise it is a generic attribute
            self.attribute[tmp] = ZioAttribute(self.fullpath, tmp)
        # Update the zObject children list
        self.obj_children.append(self.buffer)
        if self.interface_type == None:
            print("No interface available for " + self.fullpath)
        elif self.interface_type == "cdev":
            # Set the interface to use (at the moment only Char Device)
            self.interface = ZioCharDevice(self)
        elif self.interface_type == "socket":
            pass