Skip to content

USB PRO: Warnings for "normal" changed packages? #1290

@rewolff

Description

@rewolff

I'm implementing an USB_PRO compatible device, reading the code that I'll have to work with...

https://github.com/OpenLightingProject/ola/blob/master/plugins/usbpro/GenericUsbProWidget.cpp#L273

Here a "changed" packet is handled. The format is designed to be able to compress changes by only sending the changed bytes not all bytes.

Now this implementation in OLA, that issues a warning if the packet is not the full maximum of 46 bytes, hints at that the original implementation was faulty.

Suppose DMX channel 30 and 160 have changed. I'd expect the device to send:

<start-of-packet: 7e><packet label: changed-data>  <length: bond, james: 0x007>
  <3: first change is at 3*8=24>  <0x40: the 6th byte has changes> <0x00: no changes in 32-39> <0> <0> <0> <newvalue for ch 30> <39 slots not sent> <end-of-packet: e7>

And then another

<length: 7>
  <20: first change is at 20*8=160>  <0x01: the frist byte has changes> <0x00: no more changes> <0> <0> <0> <newvalue for ch 160> <39 slots not sent>

I don't HAVE any original devices, so I can't test them. But I'd expect the olad console to be flooded with these warnings for devices doing "the right thing".

So... IMHO the warning and return should go. Wait! Actually... The check should be against the minimum packet length of 6 or 7. (minimum valid packet length is 6. But it'd be odd to send one. And "return" is a valid action. So I can live with a warning in that case. The realistic minimum is 7.

Agreed? Anybody?

Actually... I just realized, you should check agianst BIGGER than the maximum changed-data-packet as well.

if (length > sizeof(widget_data_changed)) {
    OLA_WARN << "Change of state packet was too big: " << length;
    return;
  }

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions