Exemplo n.º 1
0
 def __init__(self, fluke, k, ports=None):
     assert isinstance(fluke, fluke8845a.Fluke8845A)
     assert isinstance(k, keithley2220.Keithley2220)
     self.fluke, self.k = fluke, k
     if not ports:
         ports = ttyusb.find_tty_usb('0403', '6001')
     #print ports
     self.eng = snapengine.SnapEngine(ports=ports)
Exemplo n.º 2
0
 def open(self):
     with self.mylock:
         if not self.isOpen():
             if self.e20_sn:
                 self.port = ttyusb.find_tty_usb_sn(
                     '10c4', 'ea60', self.e20_sn)
             else:
                 e20_ports = ttyusb.find_tty_usb('10c4', 'ea60')
                 if len(e20_ports) > 1:
                     raise 'more than one olimex connected'\
                     'but serial number is not specified'
                 self.port = e20_ports[0]
             super(E20Com, self).open()
     return self.port
Exemplo n.º 3
0

if __name__ == "__main__":
    dup = None
    try:
         # Make settings accessible to user by
        # executing user script(s)
        # Path of the script(s) received as command line argument(s)
        tester.process_settings(globals())
        eng = snapengine.SnapEngine(
            license_file=license_file,
            nvparams_file=nvparams_file,
            )

        if bk_usb_serial:
            bk_port = ttyusb.find_tty_usb('067b', '2303')
            print 'USB Port for BK 1788 = ', bk_port

        bk = ps178xx.PS178x()    
        bk.Initialize(bk_port[0], 38400) # Open a serial connection
        bk.SetMaxVoltage(24.1)
        bk.SetOutCurrent(4.5)
        bk.SetRemoteControl()
        bk.SetOutVoltage(12.0)

        k = bk
        gwpstester = GWPSTester(eng,k)
        
        if token:
            from dropup import dropup
            dup = dropup.DropUp(gwpstester.datadir, "/", token)
Exemplo n.º 4
0
                    str2hexstr(mac))
                break
            except:
                print(
                    'with CRC enabled, communication failed with node %s' %
                    str2hexstr(mac))
        self.retry = retry_save

if __name__ == "__main__":
    #from ttyusb import find_tty_usb_sn
    from ttyusb import find_tty_usb
    #port = find_tty_usb_sn('0403', '6001', usb_serial_number)
    #snap = SnapEngine(snap.SERIAL_TYPE_RS232, port, mac_address)
    #print 'local_address =', str2hexstr(snap.local_address)
    #snap.call(mac_address, 'setPinDir', 6, True)
    #i = 0
    #while i < 7:
        #i += 1
        #snap.call(mac_address, 'writePin', 6, True)
        #sleep(.25)
        #snap.call(mac_address, 'writePin', 6, False)
        #sleep(.25)
    #port = find_tty_usb_sn('0403', '6001', 'FTVTL43D')
    ports = find_tty_usb('067b', '2303')
    print ports
    port = ports[0]
    eng = SnapEngine(port)
    #print 'local_address =', str2hexstr(snap.local_address)
    eng.enable_crc('\x05\x46\x52')
    print eng.read_snappy_os_version('\x05\x46\x52')
Exemplo n.º 5
0
#        if not idn.startswith('FLUKE,8845A,'):
#            raise Exception('Unexpected IDN: %s' % idn)
#        self.write('SYST:REM\r\n')

    def login(self):
        cmd = 'snap\r'
        self.write(cmd)
        line = self.readlines()
        return line
        
    def Exit(self):
        cmd = 'snap\r'
        self.write(cmd)
        line = self.readlines()
        return line

    def get_info(self):
        cmd = 'cat /etc/e20_revision\r'
        self.write(cmd)
        line = self.readlines()
        return line


if __name__ == "__main__":
#    e20_usb_sn = 'AH0108P7'
    import ttyusb
    port = ttyusb.find_tty_usb('10c4', 'ea60')
    e20_port = serial.Serial(port, baudrate)
    print e20_port
    e20 = E20Base(e20_port)
Exemplo n.º 6
0
        tester.process_settings(globals())
#        check_file_md5sum(eng1_firmware_file, eng1_firmware_md5sum)
#        check_file_md5sum(eng1_spy_file, eng1_spy_md5sum)
#        if scb_firmware_md5sum:
#            m = hashlib.md5()
            #with open(scb_firmware_file, 'rb') as content_file:
                #m.update(content_file.read())
            #my_digest = m.hexdigest()
            #if my_digest != scb_firmware_md5sum:
                #raise Exception('Firmware checksum test failed')

        ports = []

        #ftdi_serial_numbers = []
        for usb_sn in ftdi_serial_numbers:
            ports.append(ttyusb.find_tty_usb('10c4', '8382'))
#            ports.append(ttyusb.find_tty_usb('067b', '2303'))
#            ports.append(ttyusb.find_tty_usb_sn('067b', '2303', ' '))
#            ports.append(ttyusb.find_tty_usb_sn('0403', '6001', 'FTG6RKT8'))
#            ports.append(ttyusb.find_tty_usb_sn('0403', '6001', usb_sn))
        for usb_sn in silab_serial_numbers:
            ports.append(ttyusb.find_tty_usb_sn('046d', 'c534', ''))
        print ports
        engine = snapengine.SnapEngine(ports=ports)
        #engine.retry = 0
        #engine.save_nv_param(11, 0)
        #try:
            #engine.call(eng1_mac, 'saveNvParam', 3, 0xbeef)  # network id
            #engine.call(eng1_mac, 'saveNvParam', 4, 7)  # channel
            #engine.call(eng1_mac, 'saveNvParam', 11, 0x11f)  # feature
            #engine.call(eng1_mac, 'reboot', 4, 0xbeef)