From mboxrd@z Thu Jan 1 00:00:00 1970 From: Laurent Pinchart Subject: Re: [PATCH v6 08/23] modetest: Add a command line parameter to set properties Date: Thu, 27 Jun 2013 11:11:40 +0200 Message-ID: <2094354.dKMbxamvuK@avalon> References: <1371245697-29504-1-git-send-email-laurent.pinchart@ideasonboard.com> <2998730.VBVDGyOTOW@avalon> <20130627083148.GX5004@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [95.142.166.194]) by gabe.freedesktop.org (Postfix) with ESMTP id A8E7AE6290 for ; Thu, 27 Jun 2013 02:11:16 -0700 (PDT) In-Reply-To: <20130627083148.GX5004@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: Ville =?ISO-8859-1?Q?Syrj=E4l=E4?= Cc: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org On Thursday 27 June 2013 11:31:48 Ville Syrj=E4l=E4 wrote: > On Thu, Jun 27, 2013 at 10:10:43AM +0200, Laurent Pinchart wrote: > > On Monday 24 June 2013 18:08:37 Ville Syrj=E4l=E4 wrote: > > > On Fri, Jun 14, 2013 at 11:34:42PM +0200, Laurent Pinchart wrote: > > > > The -w parameter can be used to set a property value from the comma= nd > > > > line, using the target object ID and the property name. > > > > = > > > > Signed-off-by: Laurent Pinchart > > > > --- > > > > = > > > > tests/modetest/modetest.c | 108 ++++++++++++++++++++++++++++++++++= ++- > > > > 1 file changed, 106 insertions(+), 2 deletions(-) > > > > = > > > > diff --git a/tests/modetest/modetest.c b/tests/modetest/modetest.c > > > > index 778af62..858d480 100644 > > > > --- a/tests/modetest/modetest.c > > > > +++ b/tests/modetest/modetest.c > > > = > > > > > > = > > > > @@ -1008,9 +1082,20 @@ static int parse_plane(struct plane_arg *p, > > > > const char *arg) > > > > return 0; > > > > } > > > > = > > > > +static int parse_property(struct property_arg *p, const char *arg) > > > > +{ > > > > + if (sscanf(arg, "%d:%32[^:]:%" SCNu64, &p->obj_id, p->name, &p- > > > > > >value) > > > > > > > !=3D 3) > > > = > > > nit: could use stringification to get rid of the magic number 32 here. > > = > > What do you mean exactly ? > = > Something like this: > = > #define str(x) #x > #define xstr(x) str(x) > sscanf(arg, "%d:%" xstr(DRM_PROP_NAME_LEN) "[^:]:%" SCNu64, ... > = > Although it does make it a bit hard to parse for a human. Right. I'm fine with both. "%m[^:]" might be an interesting alternative = option. -- = Regards, Laurent Pinchart