On Wed, Nov 11, 2015 at 1:38 PM, Alexey Brodkin <[email protected]> wrote: > Hi Jonas, > > On Wed, 2015-11-11 at 12:19 +0100, Jonas Gorski wrote: >> Hi Alexey, >> >> On Tue, Nov 10, 2015 at 5:40 PM, Alexey Brodkin >> <[email protected]> wrote: >> > Hi Jonas, >> > >> > On Tue, 2015-11-10 at 12:02 +0100, Jonas Gorski wrote: > >> > > Hi Alexey, >> I see what you want, but the way you are doing it is quite error prone >> and inefficient. If you insist on using the compatible, i suggest: >> >> 1. Extract the first one instead of grepping through the full >> compatible set, so you don't need to invoke grep for each comparison >> (also dropping the misuse of cat ;p). > > The problem is how multientry compatible string is presented in /proc fs: > -------------------->8------------------------ > $ cat /proc/device-tree/compatible > snps,axs101snps,arc-sdp > -------------------->8------------------------ > > You see there's no delimiter between "snps,axs101" and "snps,arc-sdp". > So how should I extract "snps,arc-sdp" from /proc/device-tree/compatible?
Well, you want to use it, you figure it out ;p. This is mostly a display issue. If you look at the actual data with e.g. hexdump: 62 72 63 6d 2c 62 63 6d 39 36 33 32 38 61 76 6e |brcm,bcm96328avn| 67 00 62 72 63 6d 2c 62 63 6d 36 33 32 38 00 |g.brcm,bcm6328.| you will see that these are two properly null-terminated strings. It's just that printing to stdout swallows the terminators, but anything working with the data should properly see them as two distinct values. Jonas _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
