Hi, On Sun, Oct 16, 2016 at 06:25:26PM +0200, Gerhard Sittig wrote: > Stick with the "one data byte per UART frame" approach for frames which > carry 5 to 8 data bits. But send two bytes per UART frames (big endian > representation) for configurations with 9 data bits. > > This addresses Bug 708, passing values greater than 255 to the bytes() > Python routine broke execution of the decoder. The proposed patch to > replace bytes() by bin() is not desirable as it generates variable width > output. Using format "{:09b}" is not desirable either as it's rather > verbose for a binary output stream, and (rather unexpectedly) switches > from a byte stream output to ASCII characters to represent individual > bits. Switching from one byte to two bytes (and only when required) is > the least intrusive approach, i.e. the least of all available evils. > Generating 16bit output data for input data which exceeds the 8bit space > should be most acceptable.
Yup, agreed. I had a similar patch in the queue already, which basically does the same thing by using to_bytes(), which is now merged. (also another one for SPI, which had a similar bug, #686) I updated the sigrok-test repo with a few test-cases to check this, but please let me know if there are any regressions with this method compared to your approach. Thanks, Uwe. -- http://hermann-uwe.de | http://randomprojects.org | http://sigrok.org ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ sigrok-devel mailing list sigrok-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sigrok-devel