The smallest packet I see from the LIFX bulbs is 36 bytes. If I add up all the bits specified in the LAN Protocol, I am seeing 16 more bits than the documentation specifies. The protocol header appears to contain 2 extra bytes in the “reserved 64 bits” section. Can someone confirm this?
The Frame occupies 64 bits or 8 bytes (bytes 0-7)
- size 16 bits
- origin 2 bites
- tagged 1 bit
- addressable 1 bit
- protocol 12 bits
- source 32 bits
The Frame Address occupies 128 bits or 16 bytes (bytes 8-23) [fixed]
- target 64 bits
- reserved 48 bits
- reserved 6 bits
- ack_required 1 bit
- res_required - 1 bit
- sequence - 8 bits
The Protocol Header occupies 96 bits or 12 bytes (bytes 24- 35) [fixed]
- reserved 64 bits
- type 16 bits
- reserved 16 bits
8 bytes for Frame + 16 bytes for Frame Address + 8 bytes for Reserved = 32 bytes, which is where you say you’re seeing the Type. So, looks good to me.
Correct, there are 36 bytes in a packet with no payload and that’s what I see coming down the pipe.
The protocol header doesn’t contain 2 extra bytes in the reserved 64 bits section. Looks like you just started counting wrong in the Frame Address which threw things out of whack.
If you are counting bytes starting at 0 then:
Frame = 8 bytes = bytes 0-7
Frame Address = 16 bytes = bytes 8-23 (not 8-24)
Protocol Header = 12 bytes = bytes 24-35 (not 25-37)
Total of 36 bytes.
Edit: Duplicate - Didn’t realize @ppelleti posted an answer a minute before I did.
Thank you for taking the time to reply.