Hi, On Mon, 11 Sep 2017 05:42:01 -0400 Rob Clark wrote: > On Mon, Sep 11, 2017 at 2:18 AM, Simon Glass <s...@chromium.org> wrote: > > On 7 September 2017 at 14:28, Rob Clark <robdcl...@gmail.com> wrote: > >> Really just the subset that is needed by efi_console. Perhaps more will > >> be added later, for example color support would be useful to implement > >> efi_cout_set_attribute(). > >> > >> Signed-off-by: Rob Clark <robdcl...@gmail.com> > >> --- > >> drivers/video/vidconsole-uclass.c | 112 > >> ++++++++++++++++++++++++++++++++++++++ > >> drivers/video/video-uclass.c | 4 +- > >> include/video.h | 7 +++ > >> include/video_console.h | 11 ++++ > >> 4 files changed, 131 insertions(+), 3 deletions(-) > >> > >> diff --git a/drivers/video/vidconsole-uclass.c > >> b/drivers/video/vidconsole-uclass.c > >> index e081d5a0ee..7998b4cf5f 100644 > >> --- a/drivers/video/vidconsole-uclass.c > >> +++ b/drivers/video/vidconsole-uclass.c > >> @@ -9,6 +9,7 @@ > >> */ > >> > >> #include <common.h> > >> +#include <linux/ctype.h> > >> #include <dm.h> > >> #include <video.h> > >> #include <video_console.h> > >> @@ -107,12 +108,123 @@ static void vidconsole_newline(struct udevice *dev) > >> video_sync(dev->parent); > >> } > >> > >> +/* > >> + * Parse a number from string that ends in a non-numeric character.. > >> + * sscanf() would be nice. This is just enough for parsing ANSI escape > >> + * sequences. > >> + */ > >> +static char *parsenum(char *s, int *num) > > > > Can you use simple_strtoul() or similar? > > Possibly, but I'm not sure it is a good idea.. I don't think escape > sequences are meant to be encoded with hex or octal number strings. > From a quick look, I don't see any escape code terminated with 'x', so > maybe it would end up working ok.. but something like ESC[0x1234m > should be an escape sequence terminated with x followed by normal > chars 1234m and strtoul would get that wrong.. > stroul(s, NULL, 10) will only parse decimal numbers and stop at non-decimal digits.
Lothar Waßmann _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot