Re: pctv452e driver first try

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Hi,
> 
> Here is the first version of my pctv452e driver,
> which does not more than setting FE Power and DiSEqC :-(
> Still under construction....
>
> The attached patch is an update to 
> mp-stb0899 tree snapshot version 2dcc2689f994
Thanks for that.

> Question about the dvb-usb framework:
> where may I put a one-time initialization which has to be done before any 
> other stuff? I didnt find some kind of init() function in dvb_usb_properties
I used the "load firmware" interface for that (don't know if it is intended for stuff
like that).

The following sample works, but didn't free all allocated memory in case
of a failure:

#define INIT_PCTV452E  0x01

static int pctv452e_load_firmware(struct usb_device *d, const struct
firmware *fw) {

  u8 *ptr, *buf;
  int bufferpos, actlen, ret;

  deb_info("starting download (fw->size=%d).\n", fw->size);

  ptr = fw->data;
  buf = kmalloc(512, GFP_KERNEL | GFP_DMA);
  bufferpos=0;

  while(bufferpos<fw->size) {
    u8 buflen=ptr[0];
    memcpy(buf, ++ptr, buflen);
    if( (ret=usb_bulk_msg(d, usb_sndbulkpipe(d, INIT_PCTV452E), buf,
buflen, &actlen, 5000)) ) {
      err("bulk message failed: %d (%d/%d)",ret,buflen,actlen);
      return ret;
    }
    ptr += buflen;
    bufferpos += buflen+1;
  }

  kfree(buf);
  deb_info("finished download (%d, %d)\n", fw->size, bufferpos);
  return 0;
}

static struct dvb_usb_properties pctv452e_properties = {
....
  .usb_ctrl = DEVICE_SPECIFIC,
  .download_firmware = pctv452e_load_firmware,
  .firmware = "dvb-usb-pctv452e.fw",
....
}

You can find the "firmware" attached. It's basically what I have snooped
when windows is initializing the device. So the name is maybe
misleading.  

The file format is very simple. You can think as blocks of bulk messages
with block length in bytes as the first byte of each block.

Roland

Attachment: dvb-usb-pctv452e.fw
Description: Binary data

_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux