From: Nick F. <nfe...@at...> - 2006-04-14 14:52:37
|
Samuel, may be will be better to change a method of firmware upload? First to check self->usbdev->descriptor.bcdDevice, than convert from decimal to hex-viewed string, and add the string to firmware name? That because if I upload valid firmware as first file, than upload is correct, otherwise it doesn't loaded, and I have no idea... The code fragment below showed my gabby modification of stir421x_patching() function ... for (i = 0; i < ARRAY_SIZE(stir421x_patches); i++) { IRDA_WARNING("%s(): Request %d to firmware %s\n", __FUNCTION__, i, stir421x_patches[i]); // fw = NULL; // Hmm... Not sure than its effective ret = request_firmware(&fw, stir421x_patches[i], &self->usbdev->dev); mdelay(FIRMWARE_IO_DELAY); IRDA_WARNING("%s(): Firmware request ret=%d\n", __FUNCTION__, ret); if (ret < 0) continue; // See the _request_firmware() internals /* We get a patch from userspace */ IRDA_WARNING("%s(): Received firmware %s (%u bytes)\n", __FUNCTION__, stir421x_patches[i], fw->size); mdelay(FIRMWARE_IO_DELAY); ret = stir421x_getfwver(fw->data, fw->size); mdelay(FIRMWARE_IO_DELAY); IRDA_WARNING("%s(): Firmware version=%d bcdDevice=%d\n", __FUNCTION__, ret, self->usbdev->descriptor.bcdDevice); mdelay(FIRMWARE_IO_DELAY); /* if ((ret < 0) || (ret != self->usbdev->descriptor.bcdDevice)) */ if (ret != self->usbdev->descriptor.bcdDevice) { /* Couldn't fetch a version, let's move on to the next file */ ret = -EINVAL; IRDA_ERROR("%s(): Invalid firmware %s version, ret=%d\n", __FUNCTION__, stir421x_patches[i], ret); release_firmware(fw); mdelay(FIRMWARE_IO_DELAY); continue; } /* If we're here, we've found a correct patch */ ret = 0; break; } IRDA_WARNING("%s(): End of firmware upload loop (return %d)\n", __FUNCTION__, ret); ... See the log - I plug in the dongle, first firmware invalid for this dongle, second is valid, but doesn't loaded Apr 14 17:34:33 titan kernel: usb 1-6: new high speed USB device using ehci_hcd and address 2 Apr 14 17:34:33 titan kernel: usb 1-6: configuration #1 chosen from 1 choice Apr 14 17:34:34 titan kernel: irda_init() Apr 14 17:34:34 titan kernel: NET: Registered protocol family 23 Apr 14 17:34:34 titan kernel: IRDA-USB found at address 2, Vendor: 66f, Product: 4210 Apr 14 17:34:34 titan kernel: irda_usb_parse_endpoints(), And our endpoints are : in=02, out=01 (512), int=00 Apr 14 17:34:34 titan kernel: Assertion failed! drivers/net/irda/irda-usb.c:irda_usb_parse_endpoints:1584 self->bulk_out_mtu == 64 Apr 14 17:34:34 titan kernel: irda_usb_init_qos(), dongle says speed=0x37F, size=0x20, window=0x8, bofs=0x80, turn=0x4 Apr 14 17:34:34 titan kernel: IrDA: Registered device irda0 ----------------------------------- Ok, here is loop begin - first turn ----------------------------------- Apr 14 17:34:34 titan kernel: stir421x_patching(): Request 0 to firmware 42101001.sb Apr 14 17:34:35 titan kernel: stir421x_patching(): Firmware request ret=0 Apr 14 17:34:35 titan kernel: stir421x_patching(): Received firmware 42101001.sb (8299 bytes) Apr 14 17:34:35 titan kernel: stir421x_getfwver(): Firmware version 1.0.1 found! Apr 14 17:34:35 titan kernel: stir421x_patching(): Firmware version=4097 bcdDevice=4098 Apr 14 17:34:35 titan kernel: stir421x_patching(): Invalid firmware 42101001.sb version, ret=-22 ----------------------------------------------- Second turn - valid firmware, but upload failed ----------------------------------------------- Apr 14 17:34:35 titan kernel: stir421x_patching(): Request 1 to firmware 42101002.sb Apr 14 17:34:35 titan kernel: stir421x_patching(): Firmware request ret=0 ----------------------------------------------- Even no message what immediately after the loop ----------------------------------------------- Apr 14 17:34:35 titan kernel: irda-usb: probe of 1-6:1.0 failed with error -22 Apr 14 17:34:35 titan kernel: usbcore: registered new driver irda-usb ------------------------ Here I unplug the dongle ------------------------ Apr 14 17:35:39 titan kernel: usb 1-6: USB disconnect, address 2 Apr 14 17:35:40 titan usb.agent[5602]: USB device /devices/pci0000:00/0000:00:1d.7/usb1/1-6 removed -------------------- And plug in it again -------------------- Apr 14 17:35:46 titan kernel: usb 1-6: new high speed USB device using ehci_hcd and address 3 Apr 14 17:35:46 titan kernel: usb 1-6: configuration #1 chosen from 1 choice Apr 14 17:35:46 titan kernel: printk: 9 messages suppressed. Apr 14 17:35:46 titan kernel: IRDA-USB found at address 3, Vendor: 66f, Product: 4210 Apr 14 17:35:46 titan kernel: irda_usb_parse_endpoints(), And our endpoints are : in=02, out=01 (512), int=00 Apr 14 17:35:46 titan kernel: Assertion failed! drivers/net/irda/irda-usb.c:irda_usb_parse_endpoints:1584 self->bulk_out_mtu == 64 Apr 14 17:35:46 titan kernel: irda_usb_init_qos(), dongle says speed=0x37F, size=0x20, window=0x8, bofs=0x80, turn=0x4 Apr 14 17:35:46 titan kernel: IrDA: Registered device irda0 Apr 14 17:35:46 titan kernel: stir421x_patching(): Request 0 to firmware 42101001.sb Apr 14 17:35:47 titan kernel: stir421x_patching(): Firmware request ret=0 Apr 14 17:35:47 titan kernel: stir421x_patching(): Received firmware 42101001.sb (8299 bytes) Apr 14 17:35:47 titan kernel: stir421x_getfwver(): Firmware version 1.0.1 found! Apr 14 17:35:47 titan kernel: stir421x_patching(): Firmware version=4097 bcdDevice=4098 Apr 14 17:35:47 titan kernel: stir421x_patching(): Invalid firmware 42101001.sb version, ret=-22 Apr 14 17:35:47 titan kernel: stir421x_patching(): Request 1 to firmware 42101002.sb Apr 14 17:35:47 titan kernel: stir421x_patching(): Firmware request ret=0 Apr 14 17:35:47 titan kernel: irda-usb: probe of 1-6:1.0 failed with error -22 Apr 14 17:35:48 titan firmware_helper[5733]: main: error loading '/lib/firmware/42101002.sb' for device '/class/firmware/1-6' with driver 'usb' ----------------------------------------------------------------- Only on second attempt I got a message from hotplug (a line above ----------------------------------------------------------------- |