コード例 #1
0
    def __init__(self):
        LaserDisplay.__init__(self)
        self.__buffer = []

        self.usbdev = usb.core.find(idVendor=0x9999, idProduct=0x5555)
        if self.usbdev is None:
            self.__send_initalization()
            self.usbdev = usb.core.find(idVendor=0x9999, idProduct=0x5555)
        if self.usbdev is None:
            raise IOError('Could not find laser device (9999:5555) ...')

        # set the active configuration
        # with no arguments, the first configuration will be the active one
        self.usbdev.set_configuration()

        # get an endpoint instance
        # first interface match the first OUT endpoint

        cfg = self.usbdev.get_active_configuration()
        interface_number = cfg[(0,0)].bInterfaceNumber
        alternate_setting = usb.control.get_interface(self.usbdev, interface_number)
        intf = usb.util.find_descriptor(cfg, bInterfaceNumber = interface_number, bAlternateSetting = alternate_setting)
        self.ep = usb.util.find_descriptor(intf,
            custom_match = \
            lambda e: \
                usb.util.endpoint_direction(e.bEndpointAddress) == \
                usb.util.ENDPOINT_OUT
        )

        assert self.ep is not None
        self.set_laser_configuration()
コード例 #2
0
    def __init__(self):
        LaserDisplay.__init__(self)
        self.__buffer = []

        self.usbdev = usb.core.find(idVendor=0x9999, idProduct=0x5555)
        if self.usbdev is None:
            self.__send_initalization()
            self.usbdev = usb.core.find(idVendor=0x9999, idProduct=0x5555)
        if self.usbdev is None:
            raise IOError('Could not find laser device (9999:5555) ...')

        # set the active configuration
        # with no arguments, the first configuration will be the active one
        self.usbdev.set_configuration()

        # get an endpoint instance
        # first interface match the first OUT endpoint

        cfg = self.usbdev.get_active_configuration()
        interface_number = cfg[(0, 0)].bInterfaceNumber
        alternate_setting = usb.control.get_interface(self.usbdev,
                                                      interface_number)
        intf = usb.util.find_descriptor(cfg,
                                        bInterfaceNumber=interface_number,
                                        bAlternateSetting=alternate_setting)
        self.ep = usb.util.find_descriptor(intf,
            custom_match = \
            lambda e: \
                usb.util.endpoint_direction(e.bEndpointAddress) == \
                usb.util.ENDPOINT_OUT
        )

        assert self.ep is not None
        self.set_laser_configuration()
コード例 #3
0
 def __init__(self):
     LaserDisplay.__init__(self)
     try:
         pygame.init()
         self.surface = pygame.display.set_mode((self.SIZE*self.SCALE, self.SIZE*self.SCALE))
         self.surface.fill( (0,0,0) )
         pygame.display.set_caption('Laser Display Simulator')
     except:
         raise IOError('Could not initialize pygame')
コード例 #4
0
 def __init__(self):
     LaserDisplay.__init__(self)
     try:
         pygame.init()
         self.surface = pygame.display.set_mode(
             (self.SIZE * self.SCALE, self.SIZE * self.SCALE))
         self.surface.fill((0, 0, 0))
         pygame.display.set_caption('Laser Display Simulator')
     except:
         raise IOError('Could not initialize pygame')
コード例 #5
0
 def __init__(self, server, port = 31337):
     try:
         self.remote = telnetlib.Telnet(server, port)
     except:
         raise IOError('Cannot reach %s:%d ...' % (server, port))
     LaserDisplay.__init__(self)
コード例 #6
0
 def __init__(self, server, port=31337):
     try:
         self.remote = telnetlib.Telnet(server, port)
     except:
         raise IOError('Cannot reach %s:%d ...' % (server, port))
     LaserDisplay.__init__(self)
コード例 #7
0
 def __init__(self, devices):
     self.devices = devices
     LaserDisplay.__init__(self)
コード例 #8
0
 def __init__(self, devices):
     self.devices = devices
     LaserDisplay.__init__(self)