> -----Original Message-----
> From: Jan Kandziora [mailto:j...@gmx.de]
> Sent: Thursday, 16 February 2017 3:01 AM
> To: OWFS (One-wire file system) discussion and help <owfs-
> develop...@lists.sourceforge.net>
> Subject: Re: [Owfs-developers] New device driver - write function not
being
> called
> 
> Am 15.02.2017 um 12:54 schrieb Alastair D'Silva:
> >
> > Command:
> > ========
> > echo "5,10,15,20,300" > /mnt/1wire/FE.DECEA5EDBEEF/channel0
> > -bash: echo: write error: Invalid argument
> >
> Is your parse_rgbw_string() tolerant against \n?

Thanks Jan, it should be, but for completeness, here it is:

static GOOD_OR_BAD parse_rgbw_string(char *buf, RGBW_CHANNEL *channel) {

        if (sscanf(buf, "%hhu,%hhu,%hhu,%hhu,%d", &channel->red,
&channel->green, &channel->blue, &channel->white, &channel->fade_time) != 5)
{
                LEVEL_DEBUG("Parsing failed");
                return gbBAD;
        }

        if (channel->fade_time >= (2^24)) {
                return gbBAD;
        }

        return gbGOOD;
}

Note that I don't get the debug message out.

I did notice that this might be the first time that writes are used on a
ft_vascii field, so I may not be following a well-tested path.

-- 
Alastair D'Silva           mob: 0423 762 819
skype: alastair_dsilva     msn: alast...@d-silva.org
blog: http://alastair.d-silva.org    Twitter: @EvilDeece




------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to