Re: [Owfs-developers] New device driver - write function not being called

2017-02-17 Thread Jan Kandziora
Am 16.02.2017 um 09:10 schrieb Alastair D'Silva:
>> -Original Message-
>> From: Alastair D'Silva [mailto:alast...@d-silva.org]
>> Sent: Thursday, 16 February 2017 7:02 PM
>> To: 'OWFS (One-wire file system) discussion and help' > develop...@lists.sourceforge.net>
>> Subject: Re: [Owfs-developers] New device driver - write function not
> being
>> called
>>
>>  if (channel->fade_time >= (2^24)) {
>>  return gbBAD;
>>  }
> 
> And there's the problem - that's not how you perform a power operation :)
> 
You're welcome. __[^_^]__

Kind regards

Jan


--
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


Re: [Owfs-developers] New device driver - write function not being called

2017-02-16 Thread Alastair D'Silva
> -Original Message-
> From: Alastair D'Silva [mailto:alast...@d-silva.org]
> Sent: Thursday, 16 February 2017 7:02 PM
> To: 'OWFS (One-wire file system) discussion and help'  develop...@lists.sourceforge.net>
> Subject: Re: [Owfs-developers] New device driver - write function not
being
> called
> 
>   if (channel->fade_time >= (2^24)) {
>   return gbBAD;
>   }

And there's the problem - that's not how you perform a power operation :)


--
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


Re: [Owfs-developers] New device driver - write function not being called

2017-02-16 Thread Alastair D'Silva
> -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  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", >red,
>green, >blue, >white, >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.orgTwitter: @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


Re: [Owfs-developers] New device driver - write function not being called

2017-02-15 Thread Jan Kandziora
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?


Kind regards

Jan

--
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


[Owfs-developers] New device driver - write function not being called

2017-02-15 Thread Alastair D'Silva
Hi folks,

I'm trying to get a new driver working, and I can't seem to get my write
functions called.

Here's the pertinent bits (from ow_iergbw.c):

READ_FUNCTION(FS_r_get_channel_0);
WRITE_FUNCTION(FS_w_set_channel_0);

static struct filetype IERGBW[] = {
F_STANDARD,
{"all_off", PROPERTY_LENGTH_YESNO, NON_AGGREGATE, ft_yesno,
fc_static, NO_READ_FUNCTION, FS_w_all_off, VISIBLE, NO_FILETYPE_DATA, },
{"channels", PROPERTY_LENGTH_INTEGER, NON_AGGREGATE, ft_unsigned,
fc_static, FS_r_count_channels, NO_WRITE_FUNCTION, VISIBLE,
NO_FILETYPE_DATA, },
{"channel0", 3+1+3+1+3+1+3+1+8+1 /* "r,g,b,w,time" */,
NON_AGGREGATE, ft_vascii, fc_volatile, FS_r_get_channel_0,
FS_w_set_channel_0, VISIBLE, NO_FILETYPE_DATA, },

};

static ZERO_OR_ERROR FS_w_set_channel(BYTE channel, struct one_wire_query
*owq)
{
RGBW_CHANNEL channelData;

channelData.channel = channel;
LEVEL_DEBUG("Channel=%d string='%s'", channel, OWQ_buffer(owq));
RETURN_ERROR_IF_BAD(parse_rgbw_string(OWQ_buffer(owq),
));
RETURN_ERROR_IF_BAD(OW_w_set_channel(, (PN(owq;

return 0;
}


static ZERO_OR_ERROR FS_w_set_channel_0(struct one_wire_query *owq)
{
LEVEL_DEBUG("here");
return FS_w_set_channel(0, owq);
}


And here is the debug output:

Successful read:
===

Command
=
cat /mnt/1wire/FE.DECEA5EDBEEF/channel0
001,002,004,000,0100

Debug
=

unique: 9, opcode: LOOKUP (1), nodeid: 1, insize: 56, pid: 17583
LOOKUP /FE.DECEA5EDBEEF
getattr /FE.DECEA5EDBEEF
   CALL: ow_fstat.c:(21) path=/FE.DECEA5EDBEEF
   CALL: ow_parsename.c:(104) path=[/FE.DECEA5EDBEEF]
  DEBUG: ow_regex.c:(154) Not found
  DEBUG: ow_regex.c:(201) 0: 0->15 found <><>
  DEBUG: ow_regex.c:(201) 1: 0->2 found <><.DECEA5EDBEEF>
  DEBUG: ow_regex.c:(201) 2: 3->15 found <>
  DEBUG: ow_cache.c:(912) Looking for device FE DE CE A5 ED BE EF E5
  DEBUG: ow_cache.c:(1070) Search in cache sn FE DE CE A5 ED BE EF E5
pointer=0x7ff3f1d178d4 index=0 size=4
  DEBUG: ow_cache.c:(1086) Value found in cache. Remaining life: 64 seconds.
  DEBUG: ow_presence.c:(75) Found device on bus 0
   CALL: ow_fstat.c:(38) ATTRIBUTES path=/FE.DECEA5EDBEEF
  DEBUG: ow_parsename.c:(63) /FE.DECEA5EDBEEF
   NODEID: 2
   unique: 9, success, outsize: 144
unique: 10, opcode: LOOKUP (1), nodeid: 2, insize: 49, pid: 17583
LOOKUP /FE.DECEA5EDBEEF/channel0
getattr /FE.DECEA5EDBEEF/channel0
   CALL: ow_fstat.c:(21) path=/FE.DECEA5EDBEEF/channel0
   CALL: ow_parsename.c:(104) path=[/FE.DECEA5EDBEEF/channel0]
  DEBUG: ow_regex.c:(154) Not found
  DEBUG: ow_regex.c:(201) 0: 0->15 found <><>
  DEBUG: ow_regex.c:(201) 1: 0->2 found <><.DECEA5EDBEEF>
  DEBUG: ow_regex.c:(201) 2: 3->15 found <>
  DEBUG: ow_cache.c:(912) Looking for device FE DE CE A5 ED BE EF E5
  DEBUG: ow_cache.c:(1070) Search in cache sn FE DE CE A5 ED BE EF E5
pointer=0x7ff3f1d178d4 index=0 size=4
  DEBUG: ow_cache.c:(1086) Value found in cache. Remaining life: 64 seconds.
  DEBUG: ow_presence.c:(75) Found device on bus 0
  DEBUG: ow_regex.c:(154) Not found
   CALL: ow_fstat.c:(38) ATTRIBUTES path=/FE.DECEA5EDBEEF/channel0
  DEBUG: ow_parsename.c:(63) /FE.DECEA5EDBEEF/channel0
   NODEID: 3
   unique: 10, success, outsize: 144
unique: 11, opcode: OPEN (14), nodeid: 3, insize: 48, pid: 17583
open flags: 0x8000 /FE.DECEA5EDBEEF/channel0
   CALL: owfs_callback.c:(127) OPEN path=/FE.DECEA5EDBEEF/channel0
   open[0] flags: 0x8000 /FE.DECEA5EDBEEF/channel0
   unique: 11, success, outsize: 32
unique: 12, opcode: READ (15), nodeid: 3, insize: 80, pid: 17583
read[0] 131072 bytes from 0 flags: 0x8000
  DEBUG: ow_parseobject.c:(163) /FE.DECEA5EDBEEF/channel0
   CALL: ow_parsename.c:(104) path=[/FE.DECEA5EDBEEF/channel0]
  DEBUG: ow_regex.c:(154) Not found
  DEBUG: ow_regex.c:(201) 0: 0->15 found <><>
  DEBUG: ow_regex.c:(201) 1: 0->2 found <><.DECEA5EDBEEF>
  DEBUG: ow_regex.c:(201) 2: 3->15 found <>
  DEBUG: ow_cache.c:(912) Looking for device FE DE CE A5 ED BE EF E5
  DEBUG: ow_cache.c:(1070) Search in cache sn FE DE CE A5 ED BE EF E5
pointer=0x7ff3f1d178d4 index=0 size=4
  DEBUG: ow_cache.c:(1086) Value found in cache. Remaining life: 64 seconds.
  DEBUG: ow_presence.c:(75) Found device on bus 0
  DEBUG: ow_regex.c:(154) Not found
  DEBUG: owfs_callback.c:(216) Requested read length 131072 will be trimmed
to owfs max 100050
  DEBUG: ow_read.c:(72) /FE.DECEA5EDBEEF/channel0
  DEBUG: ow_read.c:(204) /FE.DECEA5EDBEEF/channel0
  DEBUG: ow_read.c:(238) About to read 
extension=0 size=100050 offset=0
  DEBUG: ow_read.c:(333) file_length=25 offset=0 size=25
  DEBUG: ow_cache.c:(835) FE DE CE A5 ED BE EF E5 size=25 IsUncachedDir=0
  DEBUG: ow_cache.c:(1070) Search in cache sn FE DE CE A5 ED BE EF E5
pointer=0x7ff3f1d10f40 index=0 size=25
  DEBUG: ow_cache.c:(1102) Value found in cache, but expired by 41 seconds.
  DEBUG: ow_select.c:(70) Selecting a path (and device)
path=/FE.DECEA5EDBEEF/channel0 SN=FE DE CE A5 ED BE EF E5 last path=00 00 00
00 00 00 00 00