In /usr/include/linux/stat.h I have these defines..

#define S_IFCHR  0020000

#define S_ISCHR(m)      (((m) & S_IFMT) == S_IFCHR)

 

The macro is called S_ISCHR(), so I don't think there are anything wrong in
the source.. Or?

 

/Christian

 

 

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Paul
Alfille
Sent: den 25 augusti 2007 12:42
To: [email protected]
Subject: Re: [Owfs-developers] Problem with BR6104KP and OWFS

 

On 8/25/07, Vladimir Loula ml. <[EMAIL PROTECTED]> wrote:

Hi,
i have problem with OWFS in router edimax BR6104KP. I install midge from
http://www.sunspot.co.uk/Projects/SWEEX/latest_distro.html . Next i 
install OWFS. When i run this :

owfs --erorr_level 9 -d /dev/ttyS1

return this :

midge# owfs --error_level 9 -d /dev/ttyS1
DEFAULT: Not a "character" device /dev/ttyS1
  DEBUG: owfs: ow_exit(0) 
midge#

midge# ls -la ttyS*
crw-------    1 root     root       4,  64 Jan  1  1970 ttyS
crw-r--r--    1 root     root       4,  64 Jan  1  2000 ttyS0
crw-r--r--    1 root     root       4,  65 Jan  1  2000 ttyS1 
midge#

Thanks for help. Greets Vlada



Vladamir,

Thank you, you found a bug!

The code that does the testing is from
module/owlib/src/c/ow_opt.c:

int OW_ArgDevice(const char *arg) 
{
    struct stat sbuf;
    if (stat(arg, &sbuf)) {
        LEVEL_DEFAULT("Cannot access device %s\n", arg);
        return 1;
    }
    if (!S_ISCHR(sbuf.st_mode)) {
        LEVEL_DEFAULT("Not a \"character\" device %s\n", arg); 
        return 1;
    }
    if (major(sbuf.st_rdev) == 99)
        return OW_ArgParallel(arg);
    if (major(sbuf.st_rdev) == 89)
        return OW_ArgI2C(arg);
    return OW_ArgSerial(arg);
}

But the correct macro is S_IFCHR (which even looks better).
I can't believe this bug has lurked here for any length of time.

Updated in the CVS, new release soon.

Paul Alfille

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Owfs-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to