All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Vlasov <vsu@altlinux.ru>
To: iSteve <isteve@rulez.cz>
Cc: "Randy.Dunlap" <rdunlap@xenotime.net>,
	linux-kernel@vger.kernel.org,
	linux-usb-devel@lists.sourceforge.net
Subject: broken modules.alias entries for some USB devices
Date: Thu, 21 Sep 2006 22:30:35 +0400	[thread overview]
Message-ID: <20060921223035.c5fda02d.vsu@altlinux.ru> (raw)
In-Reply-To: <20060921165424.139138e5@silver>

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

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.

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

  reply	other threads:[~2006-09-21 18:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-20 16:53 modules.isapnpmap vs modules.alias iSteve
2006-09-20 17:22 ` Randy.Dunlap
2006-09-21 14:54   ` modules.isapnpmap vs modules.alias (now: modules.usbmap vs alias) iSteve
2006-09-21 18:30     ` Sergey Vlasov [this message]
2006-09-21 19:03       ` broken modules.alias entries for some USB devices iSteve

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060921223035.c5fda02d.vsu@altlinux.ru \
    --to=vsu@altlinux.ru \
    --cc=isteve@rulez.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --cc=rdunlap@xenotime.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.