Esempio n. 1
0
 def parse_devices(self):
     """Creates an array of Device objects from the channel"""
     devices = []
     for device in self._channel_dict["devices"]:
         devices.append(
             Device(device, self._is_sixteen_bit, self._ignore_list))
     return devices
Esempio n. 2
0
 def device(self):
     """The associated Device object."""
     if self._device:
         return self._device
     device = Device(self, addr='::1')
     device.configure()
     self._device = device
     return self._device
Esempio n. 3
0
 def test_configure(self):
     device = Device(self.buildenv, '::1')
     device.configure()
     self.assertEqual(
         device.ssh_config,
         self.buildenv.path(
             self.buildenv.build_dir, 'ssh-keys', 'ssh_config'))
     self.assertFalse(device.ssh_identity)
     self.assertFalse(device.ssh_options)
     self.assertFalse(device.ssh_verbosity)
Esempio n. 4
0
    def test_ssh_identity(self):
        device = Device(self.buildenv, '::1')
        self.assertFalse(device.ssh_identity)

        with self.assertRaises(ValueError):
            device.ssh_identity = 'no_such_identity'
        ssh_identity = 'ssh_identity'
        self.host.touch(ssh_identity)
        device.ssh_identity = ssh_identity
        self.assertEqual(['-i', ssh_identity], device.ssh_opts())
Esempio n. 5
0
    def test_ssh_config(self):
        device = Device(self.buildenv, '::1')
        self.assertFalse(device.ssh_config)

        with self.assertRaises(ValueError):
            device.ssh_config = 'no_such_config'
        ssh_config = 'ssh_config'
        self.host.touch(ssh_config)
        device.ssh_config = ssh_config
        self.assertEqual(['-F', ssh_config], device.ssh_opts())
Esempio n. 6
0
    def init(self, dma_id):
        if self._init_done:
            logging.warning("Already initialized! Skip init")
            return

        self.dma_id = dma_id
        self.dev = Device()
        self.dev.open_device()
        self.sdl = StreamDescList(self.dev)
        self.ipc = Ipc(self.dev)
        self._init_done = True
Esempio n. 7
0
    def test_ssh_option(self):
        device = Device(self.factory, addr='::1')
        self.assertEqual(device.ssh_options, [])

        device.ssh_options = ['StrictHostKeyChecking no']
        device.ssh_options.append('UserKnownHostsFile=/dev/null')
        self.assertEqual([
            '-o',
            'StrictHostKeyChecking no',
            '-o',
            'UserKnownHostsFile=/dev/null',
        ], device.ssh_opts())
Esempio n. 8
0
def on_start_input(cmd: pcmd.Command, args: List[str], indi: int) -> None:
    """Callback for `start input` - adds an input device"""
    try:
        ch.add_ist(
            Device(pa,
                   format=pyaudio.paFloat32,
                   channels=1,
                   rate=params.SMPRATE,
                   input=True,
                   input_device_index=indi))
    except Exception as e:
        utils.printerr(str(e))
Esempio n. 9
0
def on_start_input(cmd: pcmd.Command, args: List[str], indi: int,
                   json: bool) -> None:
    """Callback for `start input` - adds an input device"""
    try:
        ch.add_ist(
            Device(pa,
                   format=pyaudio.paFloat32,
                   channels=1,
                   rate=params.SMPRATE,
                   input=True,
                   input_device_index=indi))
        if json:
            print(JSON.dumps({}))
    except Exception as e:
        if not json:
            utils.printerr(str(e))
        else:
            print(JSON.dumps({
                'error': str(e),
            }))
Esempio n. 10
0
    def test_ssh_verbosity(self):
        device = Device(self.buildenv, '::1')
        self.assertEqual(device.ssh_verbosity, 0)

        with self.assertRaises(ValueError):
            device.ssh_verbosity = 4

        device.ssh_verbosity = 3
        self.assertEqual(['-vvv'], device.ssh_opts())

        device.ssh_verbosity = 2
        self.assertEqual(['-vv'], device.ssh_opts())

        device.ssh_verbosity = 1
        self.assertEqual(['-v'], device.ssh_opts())

        device.ssh_verbosity = 0
        self.assertEqual([], device.ssh_opts())

        with self.assertRaises(ValueError):
            device.ssh_verbosity = -1
Esempio n. 11
0
def main():
    """ Main Entry Point """

    args = parse_args()

    log_level = logging.INFO
    if args.debug:
        log_level = logging.DEBUG

    logging.basicConfig(level=log_level, format="%(message)s")

    dev = Device()
    dev.open_device()

    etrace = Etrace(dev)
    etrace.print()

    if args.hexdump:
        etrace.hexdump()

    if args.output_file:
        etrace.save(args.output_file)
Esempio n. 12
0

# Character passed in mailbox ID field
def mailbox_poll_char(dev):
    while True:
        if dev.dsp_hipct.value & regs.ADSP_IPC_HIPCT_BUSY:

            # Use only id for passing character
            character = dev.dsp_hipct.value & regs.ADSP_IPC_HIPCT_MSG

            # Get readable character
            character &= 0x10FFFF

            print('{}'.format(chr(character)), end='')

            # Clear interrupt
            dev.dsp_hipct.value |= regs.ADSP_IPC_HIPCT_BUSY
        else:
            sleep(0.005)


if __name__ == "__main__":
    # Clear Done if needed
    #dev.dsp_hipct.value |= regs.ADSP_IPC_HIPCT_BUSY

    # Use Device library for controlling registers
    device = Device()
    device.open_device()

    mailbox_poll_mem(device)
Esempio n. 13
0
 def _create_device(self, name, params):
     return Device(name=params[name],
                   terminal_list=params[name]['terminal'],
                   default_terminal=params[name]['default_terminal'],
                   logger=logger)