コード例 #1
0
 def _read_design_info_from_host(self, device=None):
     """
     Katcp request for extra system information embedded in the boffile.
     :param device: can specify a device name if you don't want everything
     :return: a dictionary of metadata
     """
     LOGGER.debug('%s: reading designinfo' % self.host)
     if device is None:
         reply, informs = self.katcprequest(name='meta',
                                            request_timeout=10.0,
                                            require_ok=True)
     else:
         reply, informs = self.katcprequest(name='meta',
                                            request_timeout=10.0,
                                            require_ok=True,
                                            request_args=(device, ))
     if reply.arguments[0] != 'ok':
         raise RuntimeError('Could not read meta information '
                            'from %s' % self.host)
     metalist = []
     for inform in informs:
         if len(inform.arguments) < 4:
             raise ValueError('Incorrect number of meta inform '
                              'arguments: %s' % str(inform.arguments))
         for arg in inform.arguments:
             arg = arg.replace('\_', ' ')
         name = inform.arguments[0]
         tag = inform.arguments[1]
         param = inform.arguments[2]
         value = inform.arguments[3:]
         if len(value) == 1:
             value = value[0]
         name = name.replace('/', '_')
         metalist.append((name, tag, param, value))
     return create_meta_dictionary(metalist)
コード例 #2
0
 def _read_design_info_from_host(self, device=None):
     """
     Katcp request for extra system information embedded in the bitstream.
     
     :param device: can specify a device name if you don't want everything
     :return: a dictionary of metadata
     """
     self.logger.debug('%s: reading designinfo' % self.host)
     if device is None:
         reply, informs = self.katcprequest(name='meta',
                                            request_timeout=10.0,
                                            require_ok=True)
     else:
         reply, informs = self.katcprequest(name='meta',
                                            request_timeout=10.0,
                                            require_ok=True,
                                            request_args=(device, ))
     if reply.arguments[0] != 'ok':
         raise RuntimeError('Could not read meta information '
                            'from %s' % self.host)
     metalist = []
     for inform in informs:
         if len(inform.arguments) < 4:
             if len(inform.arguments) == 3:
                 self.logger.warn('Incorrect number of meta inform '
                                  'arguments, missing value '
                                  'field: %s' % str(inform.arguments))
                 inform.arguments.append('-1')
             else:
                 self.logger.error('FEWER than THREE meta inform '
                                   'arguments: %s' % str(inform.arguments))
                 continue
         for arg in inform.arguments:
             arg = arg.replace('\_', ' ')
         name = inform.arguments[0]
         tag = inform.arguments[1]
         param = inform.arguments[2]
         value = inform.arguments[3:]
         if len(value) == 1:
             value = value[0]
         name = name.replace('/', '_')
         metalist.append((name, tag, param, value))
     self._process_git_info(metalist)
     return create_meta_dictionary(metalist)
コード例 #3
0
ファイル: transport_katcp.py プロジェクト: ska-sa/casperfpga
 def _read_design_info_from_host(self, device=None):
     """
     Katcp request for extra system information embedded in the bitstream.
     :param device: can specify a device name if you don't want everything
     :return: a dictionary of metadata
     """
     self.logger.debug('%s: reading designinfo' % self.host)
     if device is None:
         reply, informs = self.katcprequest(
             name='meta', request_timeout=10.0, require_ok=True)
     else:
         reply, informs = self.katcprequest(
             name='meta', request_timeout=10.0, require_ok=True,
             request_args=(device, ))
     if reply.arguments[0] != 'ok':
         raise RuntimeError('Could not read meta information '
                            'from %s' % self.host)
     metalist = []
     for inform in informs:
         if len(inform.arguments) < 4:
             if len(inform.arguments) == 3:
                 self.logger.warn('Incorrect number of meta inform '
                             'arguments, missing value '
                             'field: %s' % str(inform.arguments))
                 inform.arguments.append('-1')
             else:
                 self.logger.error('FEWER than THREE meta inform '
                              'arguments: %s' % str(inform.arguments))
                 continue
         for arg in inform.arguments:
             arg = arg.replace('\_', ' ')
         name = inform.arguments[0]
         tag = inform.arguments[1]
         param = inform.arguments[2]
         value = inform.arguments[3:]
         if len(value) == 1:
             value = value[0]
         name = name.replace('/', '_')
         metalist.append((name, tag, param, value))
     self._process_git_info(metalist)
     return create_meta_dictionary(metalist)
コード例 #4
0
ファイル: katcp_fpga.py プロジェクト: wziyong/casperfpga
 def _read_design_info_from_host(self, device=None):
     """
     Katcp request for extra system information embedded in the boffile.
     :param device: can specify a device name if you don't want everything
     :return: a dictionary of metadata
     """
     LOGGER.debug('%s: reading designinfo' % self.host)
     if device is None:
         reply, informs = self.katcprequest(name='meta', request_timeout=5.0, require_ok=True)
     else:
         reply, informs = self.katcprequest(name='meta', request_timeout=5.0, require_ok=True,
                                            request_args=(device, ))
     if reply.arguments[0] != 'ok':
         raise RuntimeError('Could not read meta information from %s' % self.host)
     metalist = []
     for inform in informs:
         if len(inform.arguments) != 4:
             raise ValueError('Incorrect number of meta inform arguments: %s' % str(inform.arguments))
         for arg in inform.arguments:
             arg = arg.replace('\_', ' ')
         name, tag, param, value = inform.arguments[0], inform.arguments[1], inform.arguments[2], inform.arguments[3]
         name = name.replace('/', '_')
         metalist.append((name, tag, param, value))
     return create_meta_dictionary(metalist)