devinfo(3) problem...
victor cruceru
victor.cruceru at gmail.com
Mon Oct 24 07:28:31 PDT 2005
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 <dr2867 at pacbell.net>
> Subject: devinfo(3) problem...
> To: freebsd-hackers at freebsd.org
> Message-ID: <435C4D7C.7080504 at pacbell.net>
> 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 )
------------------------------------------------
More information about the freebsd-hackers
mailing list