Subject: Re: usb EIO return w. DIAGNOSTIC
To: Wolfgang Rupprecht <wolfgang@wsrcc.com>
From: Lennart Augustsson <lennart@mail.augustsson.net>
List: tech-kern
Date: 02/19/2001 21:57:15
pipeh is not supposed to ever be NULL, so something is wrong in ugen, I guess.
-- Lennart
Wolfgang Rupprecht wrote:
> I'm wondering if the EIO returns in /sys/dev/usb/ugen.c that are
> inside DIAGNOSTIC ifdefs are still correct.
>
> Without the DIAGNOSTIC ifdefs turned on the kernel plods along as best
> it can (even when pipeh is NULL). With DIAGNOSTIC on the kernel
> throws up its hands and returns early with an EIO error. This seems
> like it might be a case of code that was changed for one flip of the
> ifdef switch but not the other. Am I reading this right?
>
> The following patch is essentially what Greg Troxel said worked for
> him in Freebsd when he got his Nikon USB camera (coolpix990) working
> there. This same patch was needed to get the coolpix990 working under
> -current.
>
> Index: ugen.c
> ===================================================================
> RCS file: /cvsroot/syssrc/sys/dev/usb/ugen.c,v
> retrieving revision 1.45
> diff -u -r1.45 ugen.c
> --- ugen.c 2000/12/13 04:05:14 1.45
> +++ ugen.c 2001/02/19 18:15:50
> @@ -502,7 +502,7 @@
> }
> if (sce->pipeh == NULL) {
> printf("ugenread: no pipe\n");
> - return (EIO);
> + /*return (EIO);*/
> }
> #endif
>
> @@ -658,7 +658,7 @@
> }
> if (sce->pipeh == NULL) {
> printf("ugenwrite: no pipe\n");
> - return (EIO);
> + /* return (EIO); */
> }
> #endif
>
> @@ -999,7 +999,7 @@
> #ifdef DIAGNOSTIC
> if (sce->pipeh == NULL) {
> printf("ugenioctl: USB_SET_SHORT_XFER, no pipe\n");
> - return (EIO);
> + /*return (EIO);*/
> }
> #endif
> if (*(int *)addr)
> @@ -1012,10 +1012,16 @@
> if (sce == NULL)
> return (EINVAL);
> #ifdef DIAGNOSTIC
> +#if 0
> + /*
> + * 20010106 gdt@ir.bbn.com
> + * This seems to always trigger, with no ill effects.
> + */
> if (sce->pipeh == NULL) {
> printf("ugenioctl: USB_SET_TIMEOUT, no pipe\n");
> return (EIO);
> }
> +#endif /* 0 */
> #endif
> sce->timeout = *(int *)addr;
> return (0);
> @@ -1271,7 +1277,7 @@
> }
> if (!sce->pipeh) {
> printf("ugenpoll: no pipe\n");
> - return (EIO);
> + /*return (EIO);*/
> }
> #endif
> s = splusb();
>
> --
> Wolfgang Rupprecht <wolfgang+gnus@dailyplanet.wsrcc.com>
> http://www.wsrcc.com/wolfgang/
> Coming soon: GPS mapping tools for Open Systems. http://www.gnomad-mapping.com/