Top / zaurus / cross / driver / s0001
  1. struct usb_device のダンプには、idVendor と idProduct に入るべき正常な値が入っているものの、
    ドライバ側のprobe( struct usb_device* dev, ... ) 関数で、dev->descriptor.idVendor は誤った場所を読んでる。


  • 青いところが struct usb_device の正しい descriptor メンバ
  • 橙いところが struct usb_device の正しい descriptor->idVendor と descriptor->idProduct メンバ
  • 赤いところが struct usb_device を誤って読んだせいでオカしくなった idVendor と idProduct

#dmesg ...

x: [usb_device] ---- DUMP START ---- 04 00 00 00 32 2e 31 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 30 2a c1 c3 30 2a c1 c3 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00 40 00 00 00 40 00 00 00 40 00 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 24 c1 c3 40 5c f0 c2 12 01 00 02 00 00 00 40 -- -- -- -- 01 00 01 02 00 01 00 00 e0 01 f8 c3 e0 01 f8 c3 e0 f9 c9 c3 ff ff ff ff 09 04 00 00 00 d0 9b c5 a0 b1 92 c3 a0 b1 92 c3 04 2b c1 c3 04 2b c1 c3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 00 80 00 00 00 80 00 00 00 80 00 00 00 80 00 00 00

x: usb_usb_probe: sizecheck: int 4, char 1, pointer 4, semaphore 20 x: usb_usb_probe: idVendor 0xf9e0, idProduct 0xc3c9 x: usb_usb_probe: invalid descriptor. usb.c: USB device 4 (vend/prod 0x----/0x----) is not claimed by any active driver. Length = 18 DescriptorType = 01 USB version = 2.00 Vendor:Product = ----:---- MaxPacketSize0 = 64 NumConfigurations = 1 Device version = 0.01 Device Class:SubClass:Protocol = 00:00:00 ...

devnum 04 00 00 00 devpath 32 2e 31 00 00 00 00 00 00 00 00 00 00 00 00 00 speed 02 00 00 00 tt 00 00 00 00 ttport 00 00 00 00 refcnt 02 00 00 00 serialize 00 00 00 00 00 00 00 00 00 00 00 00 30 2a c1 c3 30 2a c1 c3 exclusive_access 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00 toggle 40 00 00 00 00 00 00 00 halted 00 00 00 00 00 00 00 00 epmaxpackin 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : 00 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00 : 40 00 00 00 40 00 00 00 40 00 00 00 40 00 00 00 epmaxpackout 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 : 00 00 00 00 00 00 00 00 00 00 00 00 00 24 c1 c3 : 40 5c f0 c2 12 01 00 02 00 00 00 40 -- -- -- -- parent 01 00 01 02 bus 00 01 00 00 descriptor .bLength e0 .bDescriptorType 01 .bcdUSB f8 c3 .bDeviceClass e0 .bDeviceSubClass 01 .bDeviceProtocol f8 .bMaxPacketSize0 c3 .idVendor e0 f9 .idProduct c9 c3



原因の候補:

  1. ドライバのコンパイルオプションがオカシイ
  2. 型のサイズが合ってない
  3. 構造体のアライメントのせい


参考: kernel-source-root/linux/include/usb.h

struct usb_device_descriptor {

__u8bLength;
__u8bDescriptorType;
__u16bcdUSB;
__u8bDeviceClass;
__u8bDeviceSubClass;
__u8bDeviceProtocol;
__u8bMaxPacketSize0;
__u16idVendor;
__u16idProduct;
__u16bcdDevice;
__u8iManufacturer;
__u8iProduct;
__u8iSerialNumber;
__u8bNumConfigurations;

} __attribute__ *1;

#define USB_MAXCHILDREN (16) struct usb_device {

intdevnum;
chardevpath[16];
enum{
USB_SPEED_UNKNOWN = 0,
USB_SPEED_LOW, USB_SPEED_FULL,
USB_SPEED_HIGH
}speed;
struct usb_tt*tt;
intttport;
atomic_trefcnt;
struct semaphoreserialize;
struct semaphoreexclusive_access;
unsigned inttoggle[2];
unsigned inthalted[2];
intepmaxpacketin[16];
intepmaxpacketout[16];
struct usb_device*parent;
struct usb_bus*bus;
struct usb_device_descriptordescriptor;
struct usb_config_descriptor*config;
struct usb_config_descriptor*actconfig;
char**rawdescriptors;
inthave_langid;
intstring_langid;
void*hcpriv;
struct list_headinodes;
struct list_headfilelist;
intmaxchild;
struct usb_device*children[ USB_MAXCHILDREN ];

};


*1 packed

トップ 編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード 新規 一覧 単語検索 最終更新 ヘルプ 最終更新のRSS xenowire
Last-modified: 2018-01-25 (木) 15:13:53