2006-09-20 16:53:14

by iSteve

[permalink] [raw]
Subject: modules.isapnpmap vs modules.alias

Greetings,
I'm looking at the modules.isapnpmap and I compare it with modules.alias file.
For example:

-modules.isapnpmap:
snd-mpu401 0xffff 0xffff 0x00000000 0xd041 0x06b0
-EOF

-modules.alias:
alias: pnp:dPNPb006*
-EOF

I am trying to resolve the isapnpmap into the alias. I figured most of it, but
I'm confused by the "PNP" part. It is obvious that vendor 0xd041 conforms to
"PNP", as all devices that have vendor 0xd041 have PNP and vice versa, similarly
for eg. vendor 0xa865 and "YMH"...

However, how can I actually translate "PNP" to "0xd041" (and/or backwards)?

Thanks in advance for any reply.
Please, CC me, as I am not subscribed to the mailing list.
--
-- iSteve


2006-09-20 17:21:47

by Randy Dunlap

[permalink] [raw]
Subject: Re: modules.isapnpmap vs modules.alias

On Wed, 20 Sep 2006 18:53:01 +0200 iSteve wrote:

> Greetings,
> I'm looking at the modules.isapnpmap and I compare it with modules.alias file.
> For example:
>
> -modules.isapnpmap:
> snd-mpu401 0xffff 0xffff 0x00000000 0xd041 0x06b0
> -EOF
>
> -modules.alias:
> alias: pnp:dPNPb006*
> -EOF
>
> I am trying to resolve the isapnpmap into the alias. I figured most of it, but
> I'm confused by the "PNP" part. It is obvious that vendor 0xd041 conforms to
> "PNP", as all devices that have vendor 0xd041 have PNP and vice versa, similarly
> for eg. vendor 0xa865 and "YMH"...
>
> However, how can I actually translate "PNP" to "0xd041" (and/or backwards)?

It's defined in the MS ISA PNP spec from
http://www.microsoft.com/whdc/resources/respec/specs/pnpisa.mspx

I just went thru the bit fiddling exercise, so holler if you
want/need help with it. (I'd rather just teach you how to fish
instead of giving you fish.)

> Thanks in advance for any reply.
> Please, CC me, as I am not subscribed to the mailing list.

---
~Randy

2006-09-21 14:54:33

by iSteve

[permalink] [raw]
Subject: Re: modules.isapnpmap vs modules.alias (now: modules.usbmap vs alias)

On Wed, 20 Sep 2006 10:22:48 -0700
"Randy.Dunlap" <[email protected]> wrote:
> It's defined in the MS ISA PNP spec from
> http://www.microsoft.com/whdc/resources/respec/specs/pnpisa.mspx
>
> I just went thru the bit fiddling exercise, so holler if you
> want/need help with it. (I'd rather just teach you how to fish
> instead of giving you fish.)

Mhm, thanks, I've got it... (also, I've found the fish itself;)

I've got one more question, this time regarding modules.usbmap.

-modules.usbmap:
ibmcam 0x000f 0x0545 0x8080 0x0002 0x0002 0x00 0x00 0x00 0x00 0x00 0x00 0x0
ibmcam 0x000f 0x0545 0x8080 0x030a 0x030a 0x00 0x00 0x00 0x00 0x00 0x00 0x0
ibmcam 0x000f 0x0545 0x8080 0x0301 0x0301 0x00 0x00 0x00 0x00 0x00 0x00 0x0
ibmcam 0x000f 0x0545 0x8002 0x030a 0x030a 0x00 0x00 0x00 0x00 0x00 0x00 0x0
ibmcam 0x000f 0x0545 0x800c 0x030a 0x030a 0x00 0x00 0x00 0x00 0x00 0x00 0x0
ibmcam 0x000f 0x0545 0x800d 0x030a 0x030a 0x00 0x00 0x00 0x00 0x00 0x00 0x0
-EOF

-With corresponding aliases:
alias usb:v0545p8080d0002dc*dsc*dp*ic*isc*ip* ibmcam
alias usb:v0545p8080d030[10-9]dc*dsc*dp*ic*isc*ip* ibmcam
alias usb:v0545p8080d0301dc*dsc*dp*ic*isc*ip* ibmcam
alias usb:v0545p8002d030[10-9]dc*dsc*dp*ic*isc*ip* ibmcam
alias usb:v0545p800Cd030[10-9]dc*dsc*dp*ic*isc*ip* ibmcam
alias usb:v0545p800Dd030[10-9]dc*dsc*dp*ic*isc*ip* ibmcam
-EOF

I absolutely do not understand the d030[10-9], where fields bcdDevice_lo and
bcdDevice_hi are 0x030a...

Looking at drivers/usb/core/usb.c, it'd seem that the MODALIAS sent upon device
event doesn't have anything like this -- it would have "[...]d030A[...]". So I
wonder, how it got generated?

-The relevant items in ibmcam.c:
static struct usb_device_id id_table[] = {
{ USB_DEVICE_VER(IBMCAM_VENDOR_ID, IBMCAM_PRODUCT_ID, 0x0002, 0x0002) },
{ USB_DEVICE_VER(IBMCAM_VENDOR_ID, IBMCAM_PRODUCT_ID, 0x030a, 0x030a) },
{ USB_DEVICE_VER(IBMCAM_VENDOR_ID, IBMCAM_PRODUCT_ID, 0x0301, 0x0301) },
{ USB_DEVICE_VER(IBMCAM_VENDOR_ID, NETCAM_PRODUCT_ID, 0x030a, 0x030a) },
{ USB_DEVICE_VER(IBMCAM_VENDOR_ID, VEO_800C_PRODUCT_ID, 0x030a, 0x030a) },
{ USB_DEVICE_VER(IBMCAM_VENDOR_ID, VEO_800D_PRODUCT_ID, 0x030a, 0x030a) },
{ }
};
-EOF

-And the resulting alias part of modinfo:
alias: usb:v0545p8080d0002dc*dsc*dp*ic*isc*ip*
alias: usb:v0545p8080d030[10-9]dc*dsc*dp*ic*isc*ip*
alias: usb:v0545p8080d0301dc*dsc*dp*ic*isc*ip*
alias: usb:v0545p8002d030[10-9]dc*dsc*dp*ic*isc*ip*
alias: usb:v0545p800Cd030[10-9]dc*dsc*dp*ic*isc*ip*
alias: usb:v0545p800Dd030[10-9]dc*dsc*dp*ic*isc*ip*
-EOF

Thanks in advance for any pointers
--
-- iSteve

2006-09-21 18:31:05

by Sergey Vlasov

[permalink] [raw]
Subject: broken modules.alias entries for some USB devices

On Thu, 21 Sep 2006 16:54:24 +0200 iSteve wrote:

> I've got one more question, this time regarding modules.usbmap.
>
> -modules.usbmap:
> ibmcam 0x000f 0x0545 0x8080 0x0002 0x0002 0x00 0x00 0x00 0x00 0x00 0x00 0x0
> ibmcam 0x000f 0x0545 0x8080 0x030a 0x030a 0x00 0x00 0x00 0x00 0x00 0x00 0x0
> ibmcam 0x000f 0x0545 0x8080 0x0301 0x0301 0x00 0x00 0x00 0x00 0x00 0x00 0x0
> ibmcam 0x000f 0x0545 0x8002 0x030a 0x030a 0x00 0x00 0x00 0x00 0x00 0x00 0x0
> ibmcam 0x000f 0x0545 0x800c 0x030a 0x030a 0x00 0x00 0x00 0x00 0x00 0x00 0x0
> ibmcam 0x000f 0x0545 0x800d 0x030a 0x030a 0x00 0x00 0x00 0x00 0x00 0x00 0x0
> -EOF
>
> -With corresponding aliases:
> alias usb:v0545p8080d0002dc*dsc*dp*ic*isc*ip* ibmcam
> alias usb:v0545p8080d030[10-9]dc*dsc*dp*ic*isc*ip* ibmcam
> alias usb:v0545p8080d0301dc*dsc*dp*ic*isc*ip* ibmcam
> alias usb:v0545p8002d030[10-9]dc*dsc*dp*ic*isc*ip* ibmcam
> alias usb:v0545p800Cd030[10-9]dc*dsc*dp*ic*isc*ip* ibmcam
> alias usb:v0545p800Dd030[10-9]dc*dsc*dp*ic*isc*ip* ibmcam
> -EOF
>
> I absolutely do not understand the d030[10-9], where fields bcdDevice_lo and
> bcdDevice_hi are 0x030a...

This surely looks like a bug.

> Looking at drivers/usb/core/usb.c, it'd seem that the MODALIAS sent upon device
> event doesn't have anything like this -- it would have "[...]d030A[...]". So I
> wonder, how it got generated?

scripts/mod/file2alias.c generates these lines from the ID tables.

> -The relevant items in ibmcam.c:
> static struct usb_device_id id_table[] = {
> { USB_DEVICE_VER(IBMCAM_VENDOR_ID, IBMCAM_PRODUCT_ID, 0x0002, 0x0002) },
> { USB_DEVICE_VER(IBMCAM_VENDOR_ID, IBMCAM_PRODUCT_ID, 0x030a, 0x030a) },
> { USB_DEVICE_VER(IBMCAM_VENDOR_ID, IBMCAM_PRODUCT_ID, 0x0301, 0x0301) },
> { USB_DEVICE_VER(IBMCAM_VENDOR_ID, NETCAM_PRODUCT_ID, 0x030a, 0x030a) },
> { USB_DEVICE_VER(IBMCAM_VENDOR_ID, VEO_800C_PRODUCT_ID, 0x030a, 0x030a) },
> { USB_DEVICE_VER(IBMCAM_VENDOR_ID, VEO_800D_PRODUCT_ID, 0x030a, 0x030a) },

The problem is that the bcdDevice field is supposed to be BCD - i.e.,
its hex representation should contain only decimal digits 0..9.
Therefore a proper USB device cannot have bcdDevice == 0x030a.
Apparently some ibmcam devices violate this and use the bcdDevice field
as if it was binary.

> { }
> };
> -EOF
>
> -And the resulting alias part of modinfo:
> alias: usb:v0545p8080d0002dc*dsc*dp*ic*isc*ip*
> alias: usb:v0545p8080d030[10-9]dc*dsc*dp*ic*isc*ip*
> alias: usb:v0545p8080d0301dc*dsc*dp*ic*isc*ip*
> alias: usb:v0545p8002d030[10-9]dc*dsc*dp*ic*isc*ip*
> alias: usb:v0545p800Cd030[10-9]dc*dsc*dp*ic*isc*ip*
> alias: usb:v0545p800Dd030[10-9]dc*dsc*dp*ic*isc*ip*

The code in scripts/mod/file2alias.c assumes that the bcdDevice_lo and
bcdDevice_hi field contain proper BCD data. Seems that, thanks to buggy
hardware, this assumption is incorrect, and the code needs to support
any hex numbers there.


Attachments:
(No filename) (2.84 kB)
(No filename) (189.00 B)
Download all attachments

2006-09-21 19:04:14

by iSteve

[permalink] [raw]
Subject: Re: broken modules.alias entries for some USB devices

On Thu, 21 Sep 2006 22:30:35 +0400
Sergey Vlasov <[email protected]> wrote:
> The problem is that the bcdDevice field is supposed to be BCD - i.e.,
> its hex representation should contain only decimal digits 0..9.
> Therefore a proper USB device cannot have bcdDevice == 0x030a.
> Apparently some ibmcam devices violate this and use the bcdDevice field
> as if it was binary.
>
> The code in scripts/mod/file2alias.c assumes that the bcdDevice_lo and
> bcdDevice_hi field contain proper BCD data. Seems that, thanks to buggy
> hardware, this assumption is incorrect, and the code needs to support
> any hex numbers there.

So the 'correct' alias for this device should be eg.:
usb:v0545p800Dd030Adc*dsc*dp*ic*isc*ip*
right?

Given this new info... what if _lo is 0x030a and _hi is 0x030f? How would the
alias look like? Or worse, what if _lo is 0x030a and _hi is 0x040a?

Would these be correct?
usb:v0545p800Dd030[A-F]dc*dsc*dp*ic*isc*ip*
usb:v0545p800Dd0[30A-40A]dc*dsc*dp*ic*isc*ip*

Thanks in advance.
--
-- iSteve