[{"id":1932,"web_url":"https://patchwork.libcamera.org/comment/1932/","msgid":"<20190619110011.GB18708@bigcity.dyn.berto.se>","date":"2019-06-19T11:00:11","subject":"Re: [libcamera-devel] [PATCH] cam: Support base 16 and base 8 when\n\tparsing integer options","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nThanks for your work.\n\nOn 2019-06-19 13:50:47 +0300, Laurent Pinchart wrote:\n> Integer options have to use base 10. This isn't user-friendly when\n> specifying pixel formats. Detect the base automatically to support base\n> 16. As a side effect, integer values starting with 0 will be interpreted\n> in base 8.\n\nI wonder if we should not use cam to experiment on how libcamera should \nexpress pixel formats. As a first step maybe we could translate the v4l2 \ninteger value to/from its string representation inside cam and if that \nproves to be useful move it to libcamera?\n\nI might not be the representation we choose in the end but by doing so \nwe would have a central place to change translation method.\n\nThat being said this patch in itself adds value to cam so,\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  src/cam/options.cpp | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/src/cam/options.cpp b/src/cam/options.cpp\n> index bea4a600d1d5..7c3948df3b5c 100644\n> --- a/src/cam/options.cpp\n> +++ b/src/cam/options.cpp\n> @@ -79,7 +79,7 @@ bool OptionsBase<T>::parseValue(const T &opt, const Option &option,\n>  \n>  \t\tif (optarg) {\n>  \t\t\tchar *endptr;\n> -\t\t\tinteger = strtoul(optarg, &endptr, 10);\n> +\t\t\tinteger = strtoul(optarg, &endptr, 0);\n>  \t\t\tif (*endptr != '\\0')\n>  \t\t\t\treturn false;\n>  \t\t} else {\n> -- \n> Regards,\n> \n> Laurent Pinchart\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","headers":{"Return-Path":"<niklas.soderlund@ragnatech.se>","Received":["from mail-lj1-x242.google.com (mail-lj1-x242.google.com\n\t[IPv6:2a00:1450:4864:20::242])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 550A76194F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 19 Jun 2019 13:00:13 +0200 (CEST)","by mail-lj1-x242.google.com with SMTP id m23so2758607lje.12\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 19 Jun 2019 04:00:13 -0700 (PDT)","from localhost (89-233-230-99.cust.bredband2.com. [89.233.230.99])\n\tby smtp.gmail.com with ESMTPSA id\n\t199sm61532ljf.44.2019.06.19.04.00.12\n\t(version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256);\n\tWed, 19 Jun 2019 04:00:12 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to\n\t:user-agent; bh=FivOZy51LMz7GcK4p+B3ZIpa/I4oQfWlD4qA430cZdc=;\n\tb=Jjqd9icUQpWbO449FSf9rOLXPnDOxiHeR3F45hH4z0F7c/qVbP/5GV7mxdovUM85Mx\n\tUpdSTqnXRnv0DPPlilzrRgXU+sUg0xlC150yMrsFwail7W7TpbumND/zh2wzRyazmSuU\n\tQOIHjNI7al8uflfsCGVo0NhzLaLH1a/Yv+eXYxymQcHK3nZ6v30ClxXSge/LXaacGbbw\n\tQg0uE+JFAEltdGOpeSzzh0aDncx+bVU/F1XxF57T8BVvDJCTILWTh+ODebI1HNSs49N4\n\tet78Ve35AZbxrTic3/XB8nod0BbrcasjOo0mRK0EMFeydZy8KrcCps79sNf/I0nfccqX\n\trnJg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to:user-agent;\n\tbh=FivOZy51LMz7GcK4p+B3ZIpa/I4oQfWlD4qA430cZdc=;\n\tb=c73fVG0ZD1WKPjCPOIrEU+XIqvP/ZF2dendc0VN9D6i5L8zu2Mg5nB28dfVciqo1qC\n\tHaXgM6Lenv1BpstcPvbD87jqKbJcQnWf92Tz7XMRkq0KVFp/rHuh9xBiBC20/qMkwFo3\n\tULZpzq4N0df44R285HDQH8emjD6Y//BPkXaHjmBFNlPtZaJOUszg/R59TF3K04qeougu\n\toZQup3xWSv5TZHAlrc54xkxoc6/YzSC4ZeODP6QKv7WX7aZBr6Z/B/0kpXjM4QDJMZmy\n\tBa1oILYD7QXLnqSn/771vlC+vMAOPfihU0Uz4jl31Azoe6PiMmSiqiAavzam7OpQB/ss\n\tpK5Q==","X-Gm-Message-State":"APjAAAWCw1XkHk6h2PeXPWwXBlABoltjHcs3nYJCBCGdryRPo2rNnPf8\n\tpmRctUW7mKysYZURSxuOV/eVX2Dn7U8=","X-Google-Smtp-Source":"APXvYqxU+pIQhThKKHdnKHGBgARFs6qX/ByWoGS2rrSQcxTP5MRGF+ohjUN38rwuVDVfuviwLsZi3A==","X-Received":"by 2002:a2e:858b:: with SMTP id\n\tb11mr12716127lji.159.1560942012774; \n\tWed, 19 Jun 2019 04:00:12 -0700 (PDT)","Date":"Wed, 19 Jun 2019 13:00:11 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190619110011.GB18708@bigcity.dyn.berto.se>","References":"<20190619105047.15380-1-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=iso-8859-1","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190619105047.15380-1-laurent.pinchart@ideasonboard.com>","User-Agent":"Mutt/1.12.0 (2019-05-25)","Subject":"Re: [libcamera-devel] [PATCH] cam: Support base 16 and base 8 when\n\tparsing integer options","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Wed, 19 Jun 2019 11:00:13 -0000"}},{"id":1943,"web_url":"https://patchwork.libcamera.org/comment/1943/","msgid":"<20190619130645.GD21753@pendragon.ideasonboard.com>","date":"2019-06-19T13:06:45","subject":"Re: [libcamera-devel] [PATCH] cam: Support base 16 and base 8 when\n\tparsing integer options","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Niklas,\n\nOn Wed, Jun 19, 2019 at 01:00:11PM +0200, Niklas Söderlund wrote:\n> On 2019-06-19 13:50:47 +0300, Laurent Pinchart wrote:\n> > Integer options have to use base 10. This isn't user-friendly when\n> > specifying pixel formats. Detect the base automatically to support base\n> > 16. As a side effect, integer values starting with 0 will be interpreted\n> > in base 8.\n> \n> I wonder if we should not use cam to experiment on how libcamera should \n> express pixel formats. As a first step maybe we could translate the v4l2 \n> integer value to/from its string representation inside cam and if that \n> proves to be useful move it to libcamera?\n\nIt's a good idea. We still have to decide on how to represent formats,\nbut the two problems can be tackled independently. I'm more and more\ntempted to use DRM 4CCs...\n\n> I might not be the representation we choose in the end but by doing so \n> we would have a central place to change translation method.\n> \n> That being said this patch in itself adds value to cam so,\n> \n> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> \n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > ---\n> >  src/cam/options.cpp | 2 +-\n> >  1 file changed, 1 insertion(+), 1 deletion(-)\n> > \n> > diff --git a/src/cam/options.cpp b/src/cam/options.cpp\n> > index bea4a600d1d5..7c3948df3b5c 100644\n> > --- a/src/cam/options.cpp\n> > +++ b/src/cam/options.cpp\n> > @@ -79,7 +79,7 @@ bool OptionsBase<T>::parseValue(const T &opt, const Option &option,\n> >  \n> >  \t\tif (optarg) {\n> >  \t\t\tchar *endptr;\n> > -\t\t\tinteger = strtoul(optarg, &endptr, 10);\n> > +\t\t\tinteger = strtoul(optarg, &endptr, 0);\n> >  \t\t\tif (*endptr != '\\0')\n> >  \t\t\t\treturn false;\n> >  \t\t} else {","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3618261913\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 19 Jun 2019 15:07:03 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CB9F8333;\n\tWed, 19 Jun 2019 15:07:02 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1560949623;\n\tbh=AUnnQgT5xEmJafXLjXxM7n73zvxqyyzoDaMIIPvtCws=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=L0T+gHHMsMqHnVCxkkNFfGWoBXZRN2r9/plDhv0E/qnQHpOyF/+DrhNmrAOXIURkU\n\tVr79EwQw3LoAS5P0V6xa12FqORpZBMAR3Eesh7TMr1avVJQkY/u30DhYkClsYMnol4\n\tW0k6C/3baDUPz5W0cXckr8cFjglp/hUsT/I6cTtg=","Date":"Wed, 19 Jun 2019 16:06:45 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190619130645.GD21753@pendragon.ideasonboard.com>","References":"<20190619105047.15380-1-laurent.pinchart@ideasonboard.com>\n\t<20190619110011.GB18708@bigcity.dyn.berto.se>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20190619110011.GB18708@bigcity.dyn.berto.se>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH] cam: Support base 16 and base 8 when\n\tparsing integer options","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Wed, 19 Jun 2019 13:07:03 -0000"}}]