Re: devinfo(3) problem...

2005-10-28 Thread John Baldwin
On Thursday 27 October 2005 11:34 am, M. Warner Losh wrote:
> In message: <[EMAIL PROTECTED]>
>
> Daniel Rudy <[EMAIL PROTECTED]> writes:
> : I analyzed the source code for devinfo(8) and used as an example of how
> : to use the devinfo(3) library.  So I knew it transversed the device tree
> : once, and my code does it twice, first time to locate (is it there?),
> : the second time to actually extract the data and use it.
>
> Maybe you've found a bug in devinfo then...  I don't think anybody has
> used it like this before.

He re-found an old bug that is already, fixed, yes. :)

-- 
John Baldwin <[EMAIL PROTECTED]>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: devinfo(3) problem...

2005-10-27 Thread M. Warner Losh
In message: <[EMAIL PROTECTED]>
Daniel Rudy <[EMAIL PROTECTED]> writes:
: I analyzed the source code for devinfo(8) and used as an example of how
: to use the devinfo(3) library.  So I knew it transversed the device tree
: once, and my code does it twice, first time to locate (is it there?),
: the second time to actually extract the data and use it.

Maybe you've found a bug in devinfo then...  I don't think anybody has
used it like this before.

Warner
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: devinfo(3) problem...

2005-10-26 Thread Daniel Rudy
At about the time of 10/26/2005 11:25 AM, John Baldwin stated the following:
> On Wednesday 26 October 2005 01:17 pm, Daniel Rudy wrote:
> 
>>At about the time of 10/25/2005 12:50 PM, victor cruceru stated the
>>
>>following:
>>
>>>Hi Daniel,
>>>Yes, this is the fix. And yes, I think that the bug was reported (at
>>>least on a mailing list...)
>>>BTW: I dare to suggest to fully upgrade your system to the "latest"
>>>6.0, it is a huge step forward from 5.4. Before doing this you may
>>>want to give it a try by booting from a CD and check  that your hw is
>>>fully functional (and detected).
>>
>>For stability reasons, I don't run the absolute latest software.  When
>>6.x comes out, I'll wait awhile for the bugs to be worked out before I
>>migrate to it.  As for hardware, I tend to run FreeBSD on older
>>hardware, so I don't think that there will be a problem with the
>>hardware being properly detected.
> 
> 
> FYI, I merged that fix back to RELENG_5 a while ago, so it will be fixed in 
> 5.5 as well as 6.0.

Oh good, now I don't have to keep track of it when I go to 5.5 then.
I'll still have to keep an eye on it for the security releases through
the remainder of 5.4 though.

>>>To check if it is your mistake or another bug in libdevinfo, you may
>>>want to run the associated tool (man -k devinfo).
>>>Hope this helps.
>>
>>Actually, the devinfo tool was working the whole time.  I tried the
>>devinfo tool before I decided to use the libdevinfo.so library.  I've
>>tested it with my code and it is working now with that one line of
>>additional code.
> 
> 
> Yes, devinfo(1) only traverses the tree once, so it didn't run into this bug.
> 

I analyzed the source code for devinfo(8) and used as an example of how
to use the devinfo(3) library.  So I knew it transversed the device tree
once, and my code does it twice, first time to locate (is it there?),
the second time to actually extract the data and use it.

-- 
Daniel Rudy
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: devinfo(3) problem...

2005-10-26 Thread John Baldwin
On Wednesday 26 October 2005 01:17 pm, Daniel Rudy wrote:
> At about the time of 10/25/2005 12:50 PM, victor cruceru stated the
>
> following:
> > Hi Daniel,
> > Yes, this is the fix. And yes, I think that the bug was reported (at
> > least on a mailing list...)
> > BTW: I dare to suggest to fully upgrade your system to the "latest"
> > 6.0, it is a huge step forward from 5.4. Before doing this you may
> > want to give it a try by booting from a CD and check  that your hw is
> > fully functional (and detected).
>
> For stability reasons, I don't run the absolute latest software.  When
> 6.x comes out, I'll wait awhile for the bugs to be worked out before I
> migrate to it.  As for hardware, I tend to run FreeBSD on older
> hardware, so I don't think that there will be a problem with the
> hardware being properly detected.

FYI, I merged that fix back to RELENG_5 a while ago, so it will be fixed in 
5.5 as well as 6.0.

> > To check if it is your mistake or another bug in libdevinfo, you may
> > want to run the associated tool (man -k devinfo).
> > Hope this helps.
>
> Actually, the devinfo tool was working the whole time.  I tried the
> devinfo tool before I decided to use the libdevinfo.so library.  I've
> tested it with my code and it is working now with that one line of
> additional code.

Yes, devinfo(1) only traverses the tree once, so it didn't run into this bug.

-- 
John Baldwin <[EMAIL PROTECTED]>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: devinfo(3) problem...

2005-10-26 Thread Daniel Rudy
At about the time of 10/25/2005 12:50 PM, victor cruceru stated the
following:
> Hi Daniel,
> Yes, this is the fix. And yes, I think that the bug was reported (at
> least on a mailing list...)
> BTW: I dare to suggest to fully upgrade your system to the "latest"
> 6.0, it is a huge step forward from 5.4. Before doing this you may
> want to give it a try by booting from a CD and check  that your hw is
> fully functional (and detected).

For stability reasons, I don't run the absolute latest software.  When
6.x comes out, I'll wait awhile for the bugs to be worked out before I
migrate to it.  As for hardware, I tend to run FreeBSD on older
hardware, so I don't think that there will be a problem with the
hardware being properly detected.

> To check if it is your mistake or another bug in libdevinfo, you may
> want to run the associated tool (man -k devinfo).
> Hope this helps.
> 

Actually, the devinfo tool was working the whole time.  I tried the
devinfo tool before I decided to use the libdevinfo.so library.  I've
tested it with my code and it is working now with that one line of
additional code.

> On 10/25/05, Daniel Rudy <[EMAIL PROTECTED]> wrote:
> 
>>At about the time of 10/24/2005 7:28 AM, victor cruceru stated the
>>following:
>>
>>>Daniel,
>>>What is the OS version you are using when this is happening?
>>>Did you try to update the libdevinfo (using cvsup for example) to a
>>>newer version?
>>>I think that under the original 5.4 it is a bug in devinfo(4) with the
>>>described behaviour below.
>>
>>I'm running 5.4-RELEASE.
>>
>>When you mentioned that it might be a bug, I went and looked at
>>/usr/src/lib/libdevinfo/devinfo.c using the cvs web depository.  I found
>>that devinfo_generation = 0 was added to the end of the devinfo_free
>>function starting at line 367.  I added the code and recompiled just
>>that library, and now everything seems to be working ok, except now I'm
>>getting a bunch of garbage on the serial number of the USB flash drive.
>> I'm not sure if it's my code, or if it's a bug in the library.
>>
>>--
>>Daniel Rudy
>>
> 
> 
> 
> --
> victor cruceru
> 
> Non est respondendum ad omnia.
> ( Cicero, Pro Murena Oratio )
> 
> 


-- 
Daniel Rudy
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: devinfo(3) problem...

2005-10-25 Thread victor cruceru
Hi Daniel,
Yes, this is the fix. And yes, I think that the bug was reported (at
least on a mailing list...)
BTW: I dare to suggest to fully upgrade your system to the "latest"
6.0, it is a huge step forward from 5.4. Before doing this you may
want to give it a try by booting from a CD and check  that your hw is
fully functional (and detected).

To check if it is your mistake or another bug in libdevinfo, you may
want to run the associated tool (man -k devinfo).
Hope this helps.

On 10/25/05, Daniel Rudy <[EMAIL PROTECTED]> wrote:
> At about the time of 10/24/2005 7:28 AM, victor cruceru stated the
> following:
> > Daniel,
> > What is the OS version you are using when this is happening?
> > Did you try to update the libdevinfo (using cvsup for example) to a
> > newer version?
> > I think that under the original 5.4 it is a bug in devinfo(4) with the
> > described behaviour below.
>
> I'm running 5.4-RELEASE.
>
> When you mentioned that it might be a bug, I went and looked at
> /usr/src/lib/libdevinfo/devinfo.c using the cvs web depository.  I found
> that devinfo_generation = 0 was added to the end of the devinfo_free
> function starting at line 367.  I added the code and recompiled just
> that library, and now everything seems to be working ok, except now I'm
> getting a bunch of garbage on the serial number of the USB flash drive.
>  I'm not sure if it's my code, or if it's a bug in the library.
>
> --
> Daniel Rudy
>


--
victor cruceru

Non est respondendum ad omnia.
( Cicero, Pro Murena Oratio )

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: devinfo(3) problem...

2005-10-25 Thread Daniel Rudy
At about the time of 10/24/2005 7:28 AM, victor cruceru stated the
following:
> Daniel,
> What is the OS version you are using when this is happening?
> Did you try to update the libdevinfo (using cvsup for example) to a
> newer version?
> I think that under the original 5.4 it is a bug in devinfo(4) with the
> described behaviour below.

I'm running 5.4-RELEASE.

When you mentioned that it might be a bug, I went and looked at
/usr/src/lib/libdevinfo/devinfo.c using the cvs web depository.  I found
that devinfo_generation = 0 was added to the end of the devinfo_free
function starting at line 367.  I added the code and recompiled just
that library, and now everything seems to be working ok, except now I'm
getting a bunch of garbage on the serial number of the USB flash drive.
 I'm not sure if it's my code, or if it's a bug in the library.

-- 
Daniel Rudy
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: devinfo(3) problem...

2005-10-24 Thread victor cruceru
Daniel,
What is the OS version you are using when this is happening?
Did you try to update the libdevinfo (using cvsup for example) to a
newer version?
I think that under the original 5.4 it is a bug in devinfo(4) with the
described behaviour below.


>
> --
>
> Message: 5
> Date: Sun, 23 Oct 2005 19:57:00 -0700
> From: Daniel Rudy <[EMAIL PROTECTED]>
> Subject: devinfo(3) problem...
> To: freebsd-hackers@freebsd.org
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=us-ascii
>
>
> Consider the following code fragment:
>
>
> (segment 2)
> Calling code section:
> /* get devinfo root nexus */
> printf("root ptr: %p\n", root);
> result = usb_devinfo_root(&root);
> printf("root ptr: %p\n", root);
> if (result < 0)
>   {
> usb_devinfo_close();
> return(-1);
>   }
>
> /* internal: get devinfo root nexus */
> int usb_devinfo_root(struct devinfo_dev **root)
>   {
> printf("root: %p\n", *root);
> *root = devinfo_handle_to_device(DEVINFO_ROOT_DEVICE);
> printf("root: %p\n", *root);  < second call printf
> if (*root == NULL)
>   {
> if (usb_param_use_error == TRUE) error("usb.c: usb_devinfo_root:
> root device not found", errno);
> if (usb_param_errors_fatal == TRUE) exit(2);
> return(-1);
>   }
> return(0);
>   }
>
> The problem is that devinfo_handle_to_device always returns a null
> pointer here.  Why?   The next code segment, devinfo_handle_to_device
> returns a proper address.
>
> (segment 1)
> /* get devinfo root nexus */
> root = devinfo_handle_to_device(DEVINFO_ROOT_DEVICE);
> if (root == NULL)
>   {
> devinfo_free();
> return(-1);
>   }
>
> output:
> usb_param_devmode: 255
> usb_param_devtype: 255
> usb_param_mode_pref: 0
> ioctl result: -1
> devinfo result: 0
> found_ioctl: 0
> found_devinfo: 1< first call
> devinfo device name: umass0
> usb_devinfo_open result: 0
> root ptr: 0x2815769c
> root: 0x2815769c
> root: 0x0   < second call
> usb.c: usb_devinfo_root: root device not found: No such file or directory
> root ptr: 0x0
> Fatal: Unable to get device information
>
>
> Now I have made sure that I have called devinfo_free() during the first
> call before calling devinfo_init() a second time.  I tried calling this
> code branch on the first time, and it executes properly, so why does it
> fail on the second call?
>
> --
> Daniel Rudy
>
>
>


--
victor cruceru

Non est respondendum ad omnia.
( Cicero, Pro Murena Oratio )

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"