Changeset - e4bdc5370fa7
[Not reviewed]
default
0 2 0
drewp@bigasterisk.com - 6 years ago 2019-06-07 23:41:42
drewp@bigasterisk.com
collector erroring
Ignore-this: 42fc8af29f4f35cf8d6a855ed5204041
2 files changed with 7 insertions and 2 deletions:
0 comments (0 inline, 0 general)
light9/collector/collector.py
Show inline comments
 
@@ -28,26 +28,28 @@ def outputMap(
 

	
 
    for dc in graph.subjects(RDF.type, L9['DeviceClass']):
 
        log.info('mapping DeviceClass %s', dc)
 
        for dev in graph.subjects(RDF.type, dc):
 
            dev = cast(DeviceUri, dev)
 
            log.info('  mapping device %s', dev)
 
            universe = cast(OutputUri, graph.value(dev, L9['dmxUniverse']))
 
            try:
 
                output = outputByUri[universe]
 
            except Exception:
 
                log.warn('dev %r :dmxUniverse %r', dev, universe)
 
                raise
 
            dmxBase = DmxIndex(
 
                cast(Literal, graph.value(dev, L9['dmxBase'])).toPython())
 
            base = graph.value(dev, L9['dmxBase'])
 
            if base is None:
 
                raise ValueError('no :dmxBase for %s' % dev)
 
            dmxBase = DmxIndex(cast(Literal, base).toPython())
 
            for row in graph.objects(dc, L9['attr']):
 
                outputAttr = cast(OutputAttr,
 
                                  graph.value(row, L9['outputAttr']))
 
                offset = DmxIndex(
 
                    cast(Literal, graph.value(row, L9['dmxOffset'])).toPython())
 
                index = DmxMessageIndex(dmxBase + offset - 1)
 
                ret[(dev, outputAttr)] = (output, index)
 
                log.debug('    map %s to %s,%s', outputAttr, output, index)
 
    return ret
 

	
 

	
 
class Collector:
light9/collector/output.py
Show inline comments
 
@@ -127,24 +127,27 @@ class Udmx(BackgroundLoopOutput):
 
                        (self.shortId(), ' '.join(map(str, buf[:16]))))
 

	
 
                sent = self.dev.send_multi_value(1, buf)
 
                if sent != len(buf):
 
                    raise ValueError("incomplete send")
 

	
 
            except usb.core.USBError as e:
 
                # not in main thread
 
                if e.errno == 75:
 
                    self._writeOverflow += 1
 
                    return
 

	
 
                if e.errno == 19:  # no such dev; usb hw restarted
 
                    reactor.crash()
 

	
 
                msg = 'usb: sending %s bytes to %r; error %r' % (len(buf),
 
                                                                 self.uri, e)
 
                log.warn(msg)
 
                raise
 

	
 

	
 
'''
 
# the code used in 2018 and before
 
class UdmxOld(BackgroundLoopOutput):
 
    
 
    def __init__(self, uri, bus):
 
        from light9.io.udmx import Udmx
0 comments (0 inline, 0 general)