linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Forward: hotplugging usb-storage: bcdDevice at fault?
@ 2002-01-17 16:22 Fumitoshi UKAI
  2002-01-17 20:22 ` David Brownell
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Fumitoshi UKAI @ 2002-01-17 16:22 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 709 bytes --]

Hi,

I received the attached mail from a user.  As he said, some entries have
bcdDevice_lo == bcdDevice_hi with match_flag & 0x0C == 0x0C, which means
matches for both device_lo and device_hi.  For examples, in 
drivers/usb/storage/unusual_devs.h:

UNUSUAL_DEV(  0x03f0, 0x0207, 0x0001, 0x0001,
                "HP",
                "CD-Writer+ 8200e",
                US_SC_8070, US_PR_SCM_ATAPI, init_8200e, 0),

But usb.agent code to match device_lo and device_hi is
bcdDevice_lo <= bcdDevice < bcdDevice_hi, so it is always fails
because bcdDevice_lo == bcdDevice_hi.

So, why usb.agent doesn't match bcdDevice_lo <= bcdDevice <=bcdDevice_hi?
Is it bugs of usb_device_id entries?

Thanks,
Fumitoshi UKAI


[-- Attachment #2: Type: message/rfc822, Size: 2619 bytes --]

[-- Attachment #2.1.1: Type: text/plain, Size: 1548 bytes --]

Dear Fumatoshi,

I'm having trouble getting hotplug to work with my HP 8230e CD Writer.  It's
a USB cdwriter, and works with the usb-storage module.  It works fine if I
modprobe usb-storage in by hand.

But hotplug doesn't recognise it, saying:
 /etc/hotplug/usb.agent: ... no modules for USB product 3f0/207/1

The entry for the device in /lib/modules/2.4.17/modules.usbmap is present,
and looks like
usb-storage          0x000f      0x03f0   0x0207    0x0001       0x0001
0x00         0x00            0x00            0x00            0x00
0x00               0x00000000

Watching the hotplug process carefully as it runs /etc/hotplug/usb.agent
when I plug the device in, I notice that it fails because bcdDevice_lo and
bcdDevice_hi are both set to 1, but the usb device (usb_bcdDevice) must
follow bcdDevice_lo <= bcdDevice < bcdDevice_hi.  That is, the module fails
to load because bcdDevice is not strictly less than bcdDevice_hi (all values
are equal to 1).

What does this mean?  What do I need to do to get it to run?  I notice that
your FinePix40i example in README.Debian:

usb-storage 0 0x04cb 0x0100 0x0000 0x0000 ...

also has bcdDevice_lo = bcdDevice_hi = 0,
and therefore ought to fail also for the same reason my cdwriter fails.  
Why does your camera succeed, while my cdwriter fails?

Thanks for any help you can provide.

Sincerely,

Drew Parsons

-- 
PGP public key available at http://people.debian.org/~dparsons/drewskey.txt
Fingerprint: A110 EAE1 D7D2 8076 5FE0  EC0A B6CE 7041 6412 4E4A

[-- Attachment #2.1.2: Type: application/pgp-signature, Size: 232 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Forward: hotplugging usb-storage: bcdDevice at fault?
  2002-01-17 16:22 Forward: hotplugging usb-storage: bcdDevice at fault? Fumitoshi UKAI
@ 2002-01-17 20:22 ` David Brownell
  2002-01-18  3:10 ` Fumitoshi UKAI
  2002-01-18  8:03 ` Matthew Dharm
  2 siblings, 0 replies; 4+ messages in thread
From: David Brownell @ 2002-01-17 20:22 UTC (permalink / raw)
  To: linux-hotplug

The match algorithm in userland is supposed to be exactly
the same as that in the kernel.  If it doesn't do the same thing,
then fix the userland version ...

There was some uncertainty about the documentation for
that kernel algorithm too, though:  it may not have matched
the code with respect to this stuff.

- Dave


----- Original Message ----- 
From: "Fumitoshi UKAI" <ukai@debian.or.jp>
To: <linux-hotplug-devel@lists.sourceforge.net>
Sent: Thursday, January 17, 2002 8:22 AM
Subject: Forward: hotplugging usb-storage: bcdDevice at fault?


> Hi,
> 
> I received the attached mail from a user.  As he said, some entries have
> bcdDevice_lo = bcdDevice_hi with match_flag & 0x0C = 0x0C, which means
> matches for both device_lo and device_hi.  For examples, in 
> drivers/usb/storage/unusual_devs.h:
> 
> UNUSUAL_DEV(  0x03f0, 0x0207, 0x0001, 0x0001,
>                 "HP",
>                 "CD-Writer+ 8200e",
>                 US_SC_8070, US_PR_SCM_ATAPI, init_8200e, 0),
> 
> But usb.agent code to match device_lo and device_hi is
> bcdDevice_lo <= bcdDevice < bcdDevice_hi, so it is always fails
> because bcdDevice_lo = bcdDevice_hi.
> 
> So, why usb.agent doesn't match bcdDevice_lo <= bcdDevice <¼dDevice_hi?
> Is it bugs of usb_device_id entries?
> 
> Thanks,
> Fumitoshi UKAI
> 
> 


_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Forward: hotplugging usb-storage: bcdDevice at fault?
  2002-01-17 16:22 Forward: hotplugging usb-storage: bcdDevice at fault? Fumitoshi UKAI
  2002-01-17 20:22 ` David Brownell
@ 2002-01-18  3:10 ` Fumitoshi UKAI
  2002-01-18  8:03 ` Matthew Dharm
  2 siblings, 0 replies; 4+ messages in thread
From: Fumitoshi UKAI @ 2002-01-18  3:10 UTC (permalink / raw)
  To: linux-hotplug

At Thu, 17 Jan 2002 12:22:39 -0800,
David Brownell wrote:
> 
> The match algorithm in userland is supposed to be exactly
> the same as that in the kernel.  If it doesn't do the same thing,
> then fix the userland version ...

Ok. The match algorithm about device_id in kernel drivers/usb/usb.c: 
usb_match_id() as follows:

		/* No need to test id->bcdDevice_lo != 0, since 0 is never
		   greater than any unsigned number. */
		if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_LO) &&
		    (id->bcdDevice_lo > dev->descriptor.bcdDevice))
			continue;

		if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_HI) &&
		    (id->bcdDevice_hi < dev->descriptor.bcdDevice))
			continue;

I believe this code has not been changed, according to
http://linuxusb.bitkeeper.com:8088/usb-2.4/anno/drivers/usb/usb.c@1.23?nav=index.html|src/.|src/drivers|src/drivers/usb

So, I'll apply the following patch.

Index: etc/hotplug/usb.agent
=================================RCS file: /cvsroot/linux-hotplug/admin/etc/hotplug/usb.agent,v
retrieving revision 1.18
diff -u -u -r1.18 usb.agent
--- etc/hotplug/usb.agent	2002/01/14 17:04:19	1.18
+++ etc/hotplug/usb.agent	2002/01/18 03:01:59
@@ -233,9 +233,9 @@
 	    continue
 	fi
 
-	# bcdDevice_lo <= bcdDevice < bcdDevice_hi
+	# bcdDevice_lo <= bcdDevice <= bcdDevice_hi
 	if [ $USB_MATCH_DEV_HI -eq $(( $match_flags & $USB_MATCH_DEV_HI )) ] &&
-	   [ $usb_bcdDevice -ge $bcdDevice_hi ]; then
+	   [ $usb_bcdDevice -gt $bcdDevice_hi ]; then
 	    continue
 	fi

Regards,
Fumitoshi UKAI

_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Forward: hotplugging usb-storage: bcdDevice at fault?
  2002-01-17 16:22 Forward: hotplugging usb-storage: bcdDevice at fault? Fumitoshi UKAI
  2002-01-17 20:22 ` David Brownell
  2002-01-18  3:10 ` Fumitoshi UKAI
@ 2002-01-18  8:03 ` Matthew Dharm
  2 siblings, 0 replies; 4+ messages in thread
From: Matthew Dharm @ 2002-01-18  8:03 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 2629 bytes --]

Hrm... this isn't right.

We discussed this a long time ago, and decided that the better way to do
this was to use an "or equals" comparison on one end.

The idea was that the common construct was to say that "devices up to
revisions x.xx have this bug", so the comparison was supposed to be
">= and <"

The kernel was supposed to be changed long ago, but I guess it never got
done.

Matt

On Fri, Jan 18, 2002 at 12:10:15PM +0900, Fumitoshi UKAI wrote:
> At Thu, 17 Jan 2002 12:22:39 -0800,
> David Brownell wrote:
> > 
> > The match algorithm in userland is supposed to be exactly
> > the same as that in the kernel.  If it doesn't do the same thing,
> > then fix the userland version ...
> 
> Ok. The match algorithm about device_id in kernel drivers/usb/usb.c: 
> usb_match_id() as follows:
> 
> 		/* No need to test id->bcdDevice_lo != 0, since 0 is never
> 		   greater than any unsigned number. */
> 		if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_LO) &&
> 		    (id->bcdDevice_lo > dev->descriptor.bcdDevice))
> 			continue;
> 
> 		if ((id->match_flags & USB_DEVICE_ID_MATCH_DEV_HI) &&
> 		    (id->bcdDevice_hi < dev->descriptor.bcdDevice))
> 			continue;
> 
> I believe this code has not been changed, according to
> http://linuxusb.bitkeeper.com:8088/usb-2.4/anno/drivers/usb/usb.c@1.23?nav=index.html|src/.|src/drivers|src/drivers/usb
> 
> So, I'll apply the following patch.
> 
> Index: etc/hotplug/usb.agent
> ===================================================================
> RCS file: /cvsroot/linux-hotplug/admin/etc/hotplug/usb.agent,v
> retrieving revision 1.18
> diff -u -u -r1.18 usb.agent
> --- etc/hotplug/usb.agent	2002/01/14 17:04:19	1.18
> +++ etc/hotplug/usb.agent	2002/01/18 03:01:59
> @@ -233,9 +233,9 @@
>  	    continue
>  	fi
>  
> -	# bcdDevice_lo <= bcdDevice < bcdDevice_hi
> +	# bcdDevice_lo <= bcdDevice <= bcdDevice_hi
>  	if [ $USB_MATCH_DEV_HI -eq $(( $match_flags & $USB_MATCH_DEV_HI )) ] &&
> -	   [ $usb_bcdDevice -ge $bcdDevice_hi ]; then
> +	   [ $usb_bcdDevice -gt $bcdDevice_hi ]; then
>  	    continue
>  	fi
> 
> Regards,
> Fumitoshi UKAI
> 
> _______________________________________________
> Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
> Linux-hotplug-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

-- 
Matthew Dharm                              Home: mdharm-usb@one-eyed-alien.net 
Maintainer, Linux USB Mass Storage Driver

I see you've been reading alt.sex.chubby.sheep voraciously.
					-- Tanya
User Friendly, 11/24/97

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-01-18  8:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-01-17 16:22 Forward: hotplugging usb-storage: bcdDevice at fault? Fumitoshi UKAI
2002-01-17 20:22 ` David Brownell
2002-01-18  3:10 ` Fumitoshi UKAI
2002-01-18  8:03 ` Matthew Dharm

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).