[PATCH v2 3/3] dtc: Support character literals in bytestrings
Anton Staaf
robotboy at google.com
Fri Sep 9 02:02:33 EST 2011
On Thu, Sep 8, 2011 at 12:07 AM, Grant Likely <grant.likely at secretlab.ca> wrote:
> On Thu, Sep 08, 2011 at 01:51:49PM +1000, David Gibson wrote:
>> On Wed, Sep 07, 2011 at 04:15:40PM -0700, Anton Staaf wrote:
>> > With this patch the following property assignment:
>> >
>> > property = ['a' 2b '\r'];
>> >
>> > is equivalent to:
>> >
>> > property = [61 2b 0d];
>>
>> So, I still have some reservations about this syntax.
>>
>> It occurred to me: do you actually need to intermix character and
>> hexbyte values that much? Could I suggest an alternate sytax as:
>>
>> property = 'a', [2b], 'r';
>>
>> The new character literals sufficiently distinct not to cause problems
>> here, and it maintains the , == bytestring append behaviour we already
>> have.
>>
>> Thoughts?
>
> Does it matter much? I'm happy with either. Is there a downside to
> the first syntax?
I don't think it matters that much, though in my use case of encoding
a keyboard mapping table I do actually intermix character literals and
two character hex values a lot. In particular, I use 00 to indicate a
key that is not present in the scan matrix. I also use hex values
with the top bit set to indicate special characters, such as modifiers
or arrow keys. So I guess I have a slight preference for my original
syntax, which has another advantage of looking a bit more C-like.
Though I could certainly use the alternate syntax as well. One last
thought, the alternate syntax will require quite a few additional
commas and square brackets, most likely causing my tables to wrap and
thus get become even longer in the dts file.
Thanks,
Anton
> g.
>
>
More information about the devicetree-discuss
mailing list