I thought there was already a firmware loading feature in the 2.6 kernels.
Did you look?

On Thu, 13 May 2004, Patrick Boettcher wrote:

> Hello list,
>
> I'm currently working on a driver for a USB-DVB device (VP-7041). This
> device needs to be initialized by a firmware. Peter Schildmann wrote a
> user-level (libusb) programm to load the firmware to the device. I wanted
> to convert this small program to kernelspace. Everything works like
> expected so far, except that the the firmware does not want to go to the
> device:
>
> Peters programm does the following to load the firmware:
>
> /* init stuff */
> for(i = 0; i < s.st_size; i += 22) {
>     b = &firmware[i];
>     addr = ((u_int16_t) b[3]) | ((u_int16_t) b[4] << 8);
>
>     ret = usb_control_msg(usb, USB_TYPE_VENDOR, 0xa0, addr, 0x0,
> &b[6], b[1], 500);
>
>     if (ret != b[1]) {
>         fprintf(stderr, "Firmware download failed\n");
>         exit(1);
>     }
> }
>
> This works.
>
> I wrote this part like this:
>
> for(i = 0; i < fw->size; i += 22) {
>     b = &fw->data[i];
>     addr = ((__u16) b[3]) | ((__u16) b[4] << 8);
>
>     retval = usb_control_msg(dev, usb_sndctrlpipe(dev,0),
>               0xa0, USB_TYPE_VENDOR,addr, 0x0, &b[6],
>               b[1], (50000 * HZ + 999) / 1000);
>
>     if (retval != b[1]) {
>        err("Error while transferring firmware (transferred size: "
>            "%d, block size: %d)",retval,b[1]);
>        break;
>     }
> }
>
> When running this code following messages appear in syslog:
>
> kernel: uhci_hcd 0000:00:1d.1: host system error, PCI problems?
> kernel: uhci_hcd 0000:00:1d.1: host controller halted, very bad!
> kernel: usb 2-1: control timeout on ep0out
>
> Not good at all I think...
>
> I think the problem is the usb_sndctrlpipe, I would appreciate if someone
> could point me in the right direction.
>
> USBSnoop in Windows show this dialog for the firmware loading sequence:
>
>
> --- snip --
> [36 ms] UsbSnoop - MyDispatchInternalIOCTL(f9417e80) : fdo=829965f0,
> Irp=82983510, IRQL=0
> [36 ms]  >>>  URB 4 going down  >>>
> -- URB_FUNCTION_VENDOR_DEVICE:
>   TransferFlags          = 00000000 (USBD_TRANSFER_DIRECTION_OUT,
> ~USBD_SHORT_TRANSFER_OK)
>   TransferBufferLength = 00000010
>   TransferBuffer       = f94290fb
>   TransferBufferMDL    = 00000000
>     00000000: f5 1c 13 92 01 d2 e8 90 7f ab 74 ff f0 90 7f a9
>   UrbLink                 = 00000000
>   RequestTypeReservedBits = 00000000
>   Request                 = 000000a0
>   Value                   = 0000147c
>   Index                   = 00000000
> [40 ms] UsbSnoop - MyInternalIOCTLCompletion(f9417db0) : fido=00000000,
> Irp=82983510, Context=82782930, IRQL=2
> [40 ms]  <<<  URB 4 coming back  <<<
> -- URB_FUNCTION_CONTROL_TRANSFER:
>   PipeHandle           = 82a0b978
>   TransferFlags        = 0000000a (USBD_TRANSFER_DIRECTION_OUT,
> USBD_SHORT_TRANSFER_OK)
>   TransferBufferLength = 00000010
>   TransferBuffer       = f94290fb
>   TransferBufferMDL    = 829d2c90
>   UrbLink              = 00000000
>   SetupPacket          =
>     00000000: 40 a0 7c 14 00 00 10 00
> [40 ms] UsbSnoop - DispatchAny(f9416610) : IRP_MJ_INTERNAL_DEVICE_CONTROL
> --- snip --
>
> This part is repeated 601 times, with different TransferBufferMDL's of
> course.
>
> If more information is required, please ask, I'd loved to give.
>
> I'm also not sure if this is the correct ml, but linux-usb-devel sounds
> more like usb core...
>
> Thanks a log in advance.
>
> best regards,
> Patrick
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by Sleepycat Software
> Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to
> deliver higher performing products faster, at low TCO.
> http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
> _______________________________________________
> [EMAIL PROTECTED]
> To unsubscribe, use the last form field at:
> https://lists.sourceforge.net/lists/listinfo/linux-usb-users
>

--
 /------------------------------------+-------------------------\
|Stephen J. Gowdy                     | SLAC, MailStop 34,       |
|http://www.slac.stanford.edu/~gowdy/ | 2575 Sand Hill Road,     |
|http://calendar.yahoo.com/gowdy      | Menlo Park CA 94025, USA |
|EMail: [EMAIL PROTECTED]       | Tel: +1 650 926 3144     |
 \------------------------------------+-------------------------/


-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users

Reply via email to