Re: fix for lsusb:unable to initialize libusb: -99

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 25, 2011 at 08:17:40AM +0530, Aruna Balakrishaiah wrote:
> 
> On Fri, Nov 25, 2011 at 12:35:06AM +0530, Aruna Balakrishaiah wrote:
> >
> > Hi Greg,
> >
> > I had not received this mail,  got it from mailing list archive. Please
> > find my answers below.
> >
> > On Wed, Nov 23, 2011 at 10:32:33PM +0530, Aruna Balakrishnaiah wrote:
> > > Signed-off-by: Aruna Balakrishnaiah <aruna@...>
> > >
> > >    lsusb throws unusual error message "unable to initialize libusb:
> -99"
> >
> > > with exit status of 1 when usb devices are not listed. Patch handles it
> > > without printing anything and returns exit status of 0.
> >
> > >Why would we want to return "good" if there was an error?
> >
> >  Since there are no usb devices in the system , it should exit saying no
> > USB devices or something similar to it. Throwing message about failure of
> > initialization of libusb may lead to confusion among users and it might
> not
> > be their concern. for example: ls on an empty directory will return with
> an
> > exit status of 0 itself. It is not treated as an error.
> 
> >Have you ever seen this error before?  As package-maintainer in a number
> >of distros for this package, no one has ever complained about it before.
> 
>  This is bug reported from one of the test teams .

What "test team" are you referring to?  Why was this not reported to the
upstream distro?

> >And I do think that the program should return an error if there are no
> >USB devices present, that means something is wrong and is easier to
> >check for, right?
> 
> Why not throw a message saying no USB devices instead of that or just
> silenty exit as lspci does.

Because that's not what it has ever done for the past 10+ years :)

Why change it now?

> > > +static int check_for_usbdevice(void)
> > > +{
> > > +		 		  struct dirent *d;
> > > +		 		  int n = 0;
> > > +		 		  DIR *dir = opendir(sysbususb);
> > > +
> > > +		 		  while ((d = readdir(dir)) != NULL) {
> > > +		 		  		 		  if (++n > 2)
> > > +
> break;
> > > +		 		  }
> > > +
> > > +		 		  closedir(dir);
> > > +
> > > +		 		  if (n <= 2)
> > > +		 		  		 		  return 1;
> > > +		 		  else
> > > +		 		  		 		  return 0;
> > > +}
> >
> > >No, we don't want to be doing this, this is why we use libusb, it
> > >handles this type of thing for us.
> >
> > Since libusb_init returns error codes , we would need a seperate function
> > to check for usb devices.
> 
> >Ok, why not change libusb to properly handle this if it's really a big
> >deal.  Wouldn't all of the packages that use also have this same issue?
> 
> Agreed .

Good, please fix this there then.

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux