Changeset - 626a79891061
[Not reviewed]
default
0 2 0
drewp@bigasterisk.com - 7 years ago 2018-06-08 03:36:13
drewp@bigasterisk.com
support for multiple Udmx outputs, according to usb bus numbeR
Ignore-this: e3b8275e6dfc7edb74fd71fdc0595e4d
2 files changed with 10 insertions and 4 deletions:
0 comments (0 inline, 0 general)
light9/collector/output.py
Show inline comments
 
@@ -130,17 +130,17 @@ class EnttecDmx(DmxOutput):
 
                                  
 
class Udmx(DmxOutput):
 
    stats = scales.collection('/output/udmx',
 
                              scales.PmfStat('update'),
 
                              scales.PmfStat('write'),
 
                              scales.IntStat('usbErrors'))
 
    def __init__(self, uri, numChannels):
 
    def __init__(self, uri, bus, numChannels):
 
        DmxOutput.__init__(self, uri, numChannels)
 
        
 
        from light9.io.udmx import Udmx
 
        self.dev = Udmx()
 
        self.dev = Udmx(bus)
 
        self.currentBuffer = ''
 
        self.lastSentBuffer = None
 
        self.lastLog = 0
 

	
 
        # Doesn't actually need to get called repeatedly, but we do
 
        # need these two things:
light9/io/udmx.py
Show inline comments
 
@@ -21,14 +21,20 @@ See https://www.illutzmination.de/udmxfi
 
or https://github.com/markusb/uDMX-linux/blob/master/uDMX.c
 
"""
 

	
 
cmd_SetChannelRange = 0x0002
 

	
 
class Udmx(object):
 
    def __init__(self):
 
        self.dev = usb.core.find(idVendor=0x16c0, idProduct=0x05dc)
 
    def __init__(self, bus):
 
        self.dev = None
 
        for dev in usb.core.find(idVendor=0x16c0, idProduct=0x05dc, find_all=True):
 
            print "udmx device at %r" % dev.bus
 
            if bus is None or bus == dev.bus:
 
                self.dev = dev
 
        if not self.dev:
 
            raise IOError('no matching udmx device found for requested bus %r' % bus)
 
        log.info('found udmx at %r', self.dev)
 
        
 
    def SendDMX(self, buf):
 
        ret = self.dev.ctrl_transfer(
 
           bmRequestType=CTRL_TYPE_VENDOR | CTRL_RECIPIENT_DEVICE | CTRL_OUT,
 
           bRequest=cmd_SetChannelRange,
0 comments (0 inline, 0 general)