* Re: [PATCH] i2c-tools: do not fail opening bus if /dev/i2c is not a directory
[not found] ` <201008181433.50995.ffainelli-MmRyKUhfbQ9GWvitb5QawA@public.gmane.org>
@ 2010-08-18 12:43 ` Jean Delvare
[not found] ` <20100818144329.50711481-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Jean Delvare @ 2010-08-18 12:43 UTC (permalink / raw)
To: Florian Fainelli; +Cc: Linux I2C
Hi Florian,
On Wed, 18 Aug 2010 14:33:50 +0200, Florian Fainelli wrote:
> In case /dev/i2c is not a directory, open_i2c_dev will fail opening
> /dev/i2c/<i2cbus> but only handles the ENOENT errno, while we should also
> handle ENOTDIR errno because this is the returned error code. The patch
> attached fixes the issue.
This is better discussed on the linux-i2c list. Redirecting...
> Signed-off-by: Florian Fainelli <ffainelli-MmRyKUhfbQ9GWvitb5QawA@public.gmane.org>
> --
> Index: tools/i2cbusses.c
> ===================================================================
> --- tools/.svn/text-base/i2cbusses.c.svn-base 2010-08-18 14:22:18.000000000 +0200
> +++ /tmp/tempfile.2.tmp 2010-08-18 14:33:12.000000000 +0200
What a ugly header. How am I supposed to apply this?
> @@ -378,7 +378,7 @@
> sprintf(filename, "/dev/i2c/%d", i2cbus);
> file = open(filename, O_RDWR);
>
> - if (file < 0 && errno == ENOENT) {
> + if (file < 0 && (errno == ENOENT || errno == ENOTDIR)) {
> sprintf(filename, "/dev/i2c-%d", i2cbus);
> file = open(filename, O_RDWR);
> }
>
I've never seen the case where /dev/i2c exists but isn't a directory
(which is why that case isn't handled.) How did you get in this
situation? It doesn't make much sense IMHO.
That being said, we can certainly apply your patch if it makes you
happy, I don't see it as being terribly useful, but it also shouldn't
hurt.
--
Jean Delvare
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] i2c-tools: do not fail opening bus if /dev/i2c is not a directory
[not found] ` <20100818144329.50711481-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
@ 2010-08-18 12:45 ` Florian Fainelli
0 siblings, 0 replies; 2+ messages in thread
From: Florian Fainelli @ 2010-08-18 12:45 UTC (permalink / raw)
To: Jean Delvare; +Cc: Linux I2C, Florian Fainelli
Hi Jean,
----- "Jean Delvare" <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org> a écrit :
> Hi Florian,
>
> On Wed, 18 Aug 2010 14:33:50 +0200, Florian Fainelli wrote:
> > In case /dev/i2c is not a directory, open_i2c_dev will fail opening
> > /dev/i2c/<i2cbus> but only handles the ENOENT errno, while we should
> also
> > handle ENOTDIR errno because this is the returned error code. The
> patch
> > attached fixes the issue.
>
> This is better discussed on the linux-i2c list. Redirecting...
>
> > Signed-off-by: Florian Fainelli <ffainelli-MmRyKUhfbQ9GWvitb5QawA@public.gmane.org>
> > --
> > Index: tools/i2cbusses.c
> > ===================================================================
> > --- tools/.svn/text-base/i2cbusses.c.svn-base 2010-08-18
> 14:22:18.000000000 +0200
> > +++ /tmp/tempfile.2.tmp 2010-08-18 14:33:12.000000000 +0200
>
> What a ugly header. How am I supposed to apply this?
>
> > @@ -378,7 +378,7 @@
> > sprintf(filename, "/dev/i2c/%d", i2cbus);
> > file = open(filename, O_RDWR);
> >
> > - if (file < 0 && errno == ENOENT) {
> > + if (file < 0 && (errno == ENOENT || errno == ENOTDIR)) {
> > sprintf(filename, "/dev/i2c-%d", i2cbus);
> > file = open(filename, O_RDWR);
> > }
> >
>
> I've never seen the case where /dev/i2c exists but isn't a directory
> (which is why that case isn't handled.) How did you get in this
> situation? It doesn't make much sense IMHO.
Well, I got another driver here living at /dev/i2c which I am slowly migrating, but I would like to have i2cdetect working anyway ;)
>
> That being said, we can certainly apply your patch if it makes you
> happy, I don't see it as being terribly useful, but it also shouldn't
> hurt.
I would be glad if you apply it. Thanks!
--
Florian
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-08-18 12:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <201008181433.50995.ffainelli@freebox.fr>
[not found] ` <201008181433.50995.ffainelli-MmRyKUhfbQ9GWvitb5QawA@public.gmane.org>
2010-08-18 12:43 ` [PATCH] i2c-tools: do not fail opening bus if /dev/i2c is not a directory Jean Delvare
[not found] ` <20100818144329.50711481-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2010-08-18 12:45 ` Florian Fainelli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).