Closed jsimonetti closed 5 years ago
@apinnecke please review if this will solve #7
Hey Jeroen,
unfortunately this still doesn't solve the issue. By extending the error block and adding the plain packet content we get the following logs:
time="2019-04-22T11:05:42+02:00" level=info msg="Using log level debug"
time="2019-04-22T11:05:42+02:00" level=info msg="Using ArtNet IP 2.0.0.20 and hostname baraddur" module=controller
time="2019-04-22T11:05:42+02:00" level=debug msg="node started" ip=2.0.0.20 module=artnet type=Controller
time="2019-04-22T11:05:42+02:00" level=info msg="Started ArtNet Controller"
time="2019-04-22T11:05:42+02:00" level=info msg="listening on 0.0.0.0:8080" module=api
time="2019-04-22T11:05:42+02:00" level=debug msg="packet sent" bytes=14 dst="2.255.255.255:6454" module=artnet type=Node
time="2019-04-22T11:05:42+02:00" level=debug msg="packet sent" bytes=239 dst="2.255.255.255:6454" module=artnet type=Node
time="2019-04-22T11:05:42+02:00" level=debug msg="received packet" bytes=14 module=artnet src="2.0.0.20:65470" type=Node
time="2019-04-22T11:05:42+02:00" level=debug msg="received packet" bytes=239 module=artnet src="2.0.0.20:65470" type=Node
time="2019-04-22T11:05:42+02:00" level=info msg="failed to parse packet from 2.0.0.20:65470: incompatible version. want: =>14, got: 0" module=artnet type=Node
time="2019-04-22T11:05:42+02:00" level=info msg="[65 114 116 45 78 101 116 0 33 0 2 0 0 20] (14)" module=artnet type=Node
time="2019-04-22T11:05:42+02:00" level=info msg="failed to parse packet from 2.0.0.20:65470: incompatible version. want: =>14, got: 0" module=artnet type=Node
time="2019-04-22T11:05:42+02:00" level=info msg="[65 114 116 45 78 101 116 0 33 0 2 0 0 20 190 255 0 0 0 0 0 0 0 0 0 0 98 97 114 97 100 100 117 114 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] (239)" module=artnet type=Node
time="2019-04-22T11:05:42+02:00" level=debug msg="received packet" bytes=14 module=artnet src="2.0.0.20:65470" type=Node
time="2019-04-22T11:05:42+02:00" level=debug msg="received packet" bytes=239 module=artnet src="2.0.0.20:65470" type=Node
time="2019-04-22T11:05:42+02:00" level=info msg="failed to parse packet from 2.0.0.20:65470: incompatible version. want: =>14, got: 0" module=artnet type=Node
time="2019-04-22T11:05:42+02:00" level=info msg="[65 114 116 45 78 101 116 0 33 0 2 0 0 20] (14)" module=artnet type=Node
time="2019-04-22T11:05:42+02:00" level=info msg="failed to parse packet from 2.0.0.20:65470: incompatible version. want: =>14, got: 0" module=artnet type=Node
time="2019-04-22T11:05:42+02:00" level=info msg="[65 114 116 45 78 101 116 0 33 0 2 0 0 20 190 255 0 0 0 0 0 0 0 0 0 0 98 97 114 97 100 100 117 114 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] (239)" module=artnet type=Node
time="2019-04-22T11:05:42+02:00" level=debug msg="received packet" bytes=239 module=artnet src="2.1.1.2:6454" type=Node
time="2019-04-22T11:05:42+02:00" level=debug msg="added node" ip=2.1.1.2 module=artnet node=light-02 type=Controller
time="2019-04-22T11:05:42+02:00" level=debug msg="received packet" bytes=239 module=artnet src="2.1.1.2:6454" type=Node
time="2019-04-22T11:05:42+02:00" level=debug msg="updated node" ip=2.1.1.2 module=artnet node=light-02 type=Controller
time="2019-04-22T11:05:43+02:00" level=debug msg="packet sent" bytes=530 dst="2.1.1.2:6454" module=artnet type=Node
time="2019-04-22T11:05:43+02:00" level=debug msg="received packet" bytes=239 module=artnet src="2.1.1.1:6454" type=Node
time="2019-04-22T11:05:43+02:00" level=debug msg="added node" ip=2.1.1.1 module=artnet node=light-01 type=Controller
time="2019-04-22T11:05:43+02:00" level=debug msg="received packet" bytes=239 module=artnet src="2.1.1.1:6454" type=Node
time="2019-04-22T11:05:43+02:00" level=debug msg="updated node" ip=2.1.1.1 module=artnet node=light-01 type=Controller
p, err := packet.Unmarshal(payload.data)
if err != nil {
n.log.Printf("failed to parse packet from %s: %v", payload.address.String(), err)
n.log.Printf("%v", payload.data)
continue
}
EDIT: So looking on the binary data it looks like the ArtPollReply (opCode 33) packet can be parsed but the endianess is wrong while reading the OpCode, which should be a bit more easy to fix but is somewhat related to #8. The packet that fails to parse is the ArtPoll packet (opCode 32) 🤔
Another note: Setting the config.Port
to the outgoing UDP port and passing this one to the ArtPollReply packet doesn't work, since the validate
method checks that value and only allows the default ArtNet Port:
Apr 22 10:40:27 light-controller-1.local controller[3013]: time="2019-04-22T10:40:27+01:00" level=info msg="failed to parse packet from 2.0.0.28:33106: invalid port: want: 6454, got: 21121" module=artnet type=Node
(The log is from one of my raspis)
Seems like I solved this in my forks branch, the only thing missing is a filter for controllers in updateNode
and a bit of cleanup.
time="2019-04-22T12:09:00+02:00" level=debug msg="Currently 3 devices are registered: [ | IP=2.0.0.20:6454 name=\"baraddur\" type=\"Controller\" manufacturer=\"\" desc=\"\" inputs=\"\" outputs=\"\" | IP=2.1.1.2:6454 name=\"light-02\" type=\"Node\" manufacturer=\"kj\" desc=\"DMXking.com eDMX4 PRO S/N 001A19201624\" inputs=\"0:0.4: PortType: Type: DMX512, Output: yes, Input: yes; 0:0.5: PortType: Type: DMX512, Output: yes, Input: yes; 0:0.6: PortType: Type: DMX512, Output: yes, Input: yes; 0:0.7: PortType: Type: DMX512, Output: yes, Input: yes\" outputs=\"0:0.4: PortType: Type: DMX512, Output: yes, Input: yes; 0:0.5: PortType: Type: DMX512, Output: yes, Input: yes; 0:0.6: PortType: Type: DMX512, Output: yes, Input: yes; 0:0.7: PortType: Type: DMX512, Output: yes, Input: yes\" | IP=2.1.1.1:6454 name=\"light-01\" type=\"Node\" manufacturer=\"kj\" desc=\"Net 0-3 eDMX4 PRO S/N 001A192011ED\" inputs=\"0:0.0: PortType: Type: DMX512, Output: yes, Input: yes; 0:0.1: PortType: Type: DMX512, Output: yes, Input: yes; 0:0.2: PortType: Type: DMX512, Output: yes, Input: yes; 0:0.3: PortType: Type: DMX512, Output: yes, Input: yes\" outputs=\"0:0.0: PortType: Type: DMX512, Output: yes, Input: yes; 0:0.1: PortType: Type: DMX512, Output: yes, Input: yes; 0:0.2: PortType: Type: DMX512, Output: yes, Input: yes; 0:0.3: PortType: Type: DMX512, Output: yes, Input: yes\"]" module=controller
This PR will change the self handling logic of a controller.
It will send an (incomplete) ArtPollReply packet whenever sending an ArtPoll packet. It also moves the logic for checking if an ArtPollReply was send by self to after the actual unmarshalling of the acket to look inside the packet's data.