Re: [PATCH] added support for DM040832731 DVB-S USB BOX - Correction

2010-09-08 Thread Mauro Carvalho Chehab
Em 29-07-2010 15:16, Mauro Carvalho Chehab escreveu:
> Em 16-07-2010 10:43, Malcolm Priestley escreveu:
>> DVB USB Driver for DM04 LME2510 + LG TDQY - P001F =(TDA8263 + TDA10086H)
>>
>> Corrected patch error.
>>
>> Signed-off-by: Malcolm Priestley 
> 
> Hi Malcom,
> 
> Please read the developers section of our Wiki page for instructions on how 
> to submit
> a driver:
>   http://linuxtv.org/wiki/index.php/Developer_Section
> 
> In special, you need to read what's inside "Submiting your work" in order to 
> fix some
> troubles I identified on your driver.

Not sure why, but I lost the email where you submitted your new driver on my 
inbox. I got it
from patchwork and applied.

Em 08-09-2010 18:01, Mauro Carvalho Chehab escreveu:
> This is an automatic generated email to let you know that the following patch 
> were queued at the 
> http://git.linuxtv.org/media-tree.git tree:
> 
> Subject: V4L/DVB: Support or LME2510(C) DM04/QQBOX USB DVB-S BOXES
> Author:  Malcolm Priestley 
> Date:Thu Sep 2 17:29:30 2010 -0300
> 
> DM04/QQBOX DVB-S USB BOX with LME2510C+SHARP:BS2F7HZ7395 or 
> LME2510+LGTDQT-P001F tuner.
> 
> [mche...@redhat.com: Fix merge conflicts/compilation and CodingStyle issues]

There were some API changes at USB, and a few trivial CodingStyle issues.

I didn't double checked if all those patchwork patches you've mentioned were 
applied. For sure
I've applied the other patch from you adding the frontend.

Please double check if everything is ok and ping me, if I missed something.

> Signed-off-by: Malcolm Priestley 
> Signed-off-by: Mauro Carvalho Chehab 
> 
>  Documentation/dvb/get_dvb_firmware|   46 ++-
>  Documentation/dvb/lmedm04.txt |   55 ++
>  drivers/media/IR/keymaps/Makefile |1 +
>  drivers/media/IR/keymaps/rc-lme2510.c |   68 +++
>  drivers/media/dvb/dvb-usb/Kconfig |   11 +
>  drivers/media/dvb/dvb-usb/Makefile|3 +
>  drivers/media/dvb/dvb-usb/lmedm04.c   |  936 
> +
>  drivers/media/dvb/dvb-usb/lmedm04.h   |  187 +++
>  include/media/rc-map.h|1 +
>  9 files changed, 1307 insertions(+), 1 deletions(-)
> 
> ---
> 
> http://git.linuxtv.org/media-tree.git?a=commitdiff;h=0a11672a8a3431296ed99be16e7cb57bc004e080
> 
> diff --git a/Documentation/dvb/get_dvb_firmware 
> b/Documentation/dvb/get_dvb_firmware
> index 350959f..59690de 100644
> --- a/Documentation/dvb/get_dvb_firmware
> +++ b/Documentation/dvb/get_dvb_firmware
> @@ -26,7 +26,8 @@ use IO::Handle;
>   "dec3000s", "vp7041", "dibusb", "nxt2002", "nxt2004",
>   "or51211", "or51132_qam", "or51132_vsb", "bluebird",
>   "opera1", "cx231xx", "cx18", "cx23885", "pvrusb2", "mpc718",
> - "af9015", "ngene", "az6027");
> + "af9015", "ngene", "az6027", "lme2510_lg", "lme2510c_s7395",
> + "lme2510c_s7395_old");
>  
>  # Check args
>  syntax() if (scalar(@ARGV) != 1);
> @@ -584,6 +585,49 @@ sub az6027{
>  
>  $firmware;
>  }
> +
> +sub lme2510_lg {
> +my $sourcefile = "LMEBDA_DVBS.sys";
> +my $hash = "fc6017ad01e79890a97ec53bea157ed2";
> +my $outfile = "dvb-usb-lme2510-lg.fw";
> +my $hasho = "caa065d5fdbd2c09ad57b399bbf55cad";
> +
> +checkstandard();
> +
> +verify($sourcefile, $hash);
> +extract($sourcefile, 4168, 3841, $outfile);
> +verify($outfile, $hasho);
> +$outfile;
> +}
> +
> +sub lme2510c_s7395 {
> +my $sourcefile = "US2A0D.sys";
> +my $hash = "b0155a8083fb822a3bd47bc360e74601";
> +my $outfile = "dvb-usb-lme2510c-s7395.fw";
> +my $hasho = "3a3cf1aeebd17b6ddc04cebe131e94cf";
> +
> +checkstandard();
> +
> +verify($sourcefile, $hash);
> +extract($sourcefile, 37248, 3720, $outfile);
> +verify($outfile, $hasho);
> +$outfile;
> +}
> +
> +sub lme2510c_s7395_old {
> +my $sourcefile = "LMEBDA_DVBS7395C.sys";
> +my $hash = "7572ae0eb9cdf91baabd7c0ba9e09b31";
> +my $outfile = "dvb-usb-lme2510c-s7395.fw";
> +my $hasho = "90430c5b435eb5c6f88fd44a9d950674";
> +
> +checkstandard();
> +
> +verify($sourcefile, $hash);
> +extract($sourcefile, 4208, 3881, $outfile);
> +verify($outfile, $hasho);
> +$outfile;
> +}
> +
>  # ---
>  # Utilities
>  
> diff --git a/Documentation/dvb/lmedm04.txt b/Documentation/dvb/lmedm04.txt
> new file mode 100644
> index 000..4bde457
> --- /dev/null
> +++ b/Documentation/dvb/lmedm04.txt
> @@ -0,0 +1,55 @@
> +To extract firmware for the DM04/QQBOX you need to copy the
> +following file(s) to this directory.
> +
> +for DM04+/QQBOX LME2510C (Sharp 7395 Tuner)
> +---
> +
> +The Sharp 7395 driver can be found in windows/system32/driver
> +
> +US2A0D.sys (dated 17 Mar 2009)
> +
> +
> +and run
> +./get_dvb_firmware lme2510c_s7395
> +
> + will produce
> + dvb-usb-lme2510c-s7395.fw
> +
> +An alternative but older firmware can be found on the driver
> +disk D

[PATCH] added support for DM040832731 DVB-S USB BOX - Correction

2010-07-16 Thread Malcolm Priestley
DVB USB Driver for DM04 LME2510 + LG TDQY - P001F =(TDA8263 + TDA10086H)

Corrected patch error.

Signed-off-by: Malcolm Priestley 



diff -r 9652f85e688a linux/drivers/media/dvb/dvb-usb/Kconfig
--- a/linux/drivers/media/dvb/dvb-usb/Kconfig   Thu May 27 02:02:09 2010 -0300
+++ b/linux/drivers/media/dvb/dvb-usb/Kconfig   Fri Jul 16 14:30:02 2010 +0100
@@ -346,3 +346,13 @@
select DVB_STB6100 if !DVB_FE_CUSTOMISE
help
  Say Y here to support the AZ6027 device
+
+config DVB_USB_LME2510
+   tristate "LME DM04 (LME 2510 + TDQY-P001F) DVB-S USB2.0 support"
+   depends on DVB_USB
+   select DVB_TDA10086 if !DVB_FE_CUSTOMISE
+   select DVB_TDA826X if !DVB_FE_CUSTOMISE
+   help
+ Say Y here to support the LME DM04 DVB-S USB2.0 .
+
+
diff -r 9652f85e688a linux/drivers/media/dvb/dvb-usb/Makefile
--- a/linux/drivers/media/dvb/dvb-usb/Makefile  Thu May 27 02:02:09 2010 -0300
+++ b/linux/drivers/media/dvb/dvb-usb/Makefile  Fri Jul 16 14:30:02 2010 +0100
@@ -88,6 +88,9 @@
 dvb-usb-az6027-objs = az6027.o
 obj-$(CONFIG_DVB_USB_AZ6027) += dvb-usb-az6027.o

+dvb-usb-lmedm04-objs = lmedm04.o
+obj-$(CONFIG_DVB_USB_LME2510) += dvb-usb-lmedm04.o
+
 EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/
 # due to tuner-xc3028
 EXTRA_CFLAGS += -Idrivers/media/common/tuners
diff -r 9652f85e688a linux/drivers/media/dvb/dvb-usb/lmedm04.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ b/linux/drivers/media/dvb/dvb-usb/lmedm04.c Fri Jul 16 14:30:02 2010 +0100
@@ -0,0 +1,910 @@
+/* DVB USB compliant linux driver for
+ *
+ * DM040832731 DVB-S USB BOX (LME 2510 + TDQY-P001F)
+ *
+ * MV001F LG TDQY - P001F =(TDA8263 + TDA10086H)
+ *
+ * I2C addresses:
+ * 0x0e - TDA10086   - Demodulator
+ * 0x60 - TDA8263- Tuner
+ *
+ * ***Please Note***
+ * There are other variants of the DM04
+ * ***NOT SUPPORTED***
+ * MVB0001F (LME2510C+LGTDQT-P001F)
+ * MV0194 (LME2510+SHARP0194)
+ * MVB0194 (LME2510C+SHARP0194)
+ * MVB7395 (LME2510C+SHARP:BS2F7HZ7395)
+ *
+ * The VID of 3344 and PID of 1122 has not been set until it is known not
+ * to be generic.
+ *
+ *
+ * Copyright (C) 2010 Malcolm Priestley (tvbox...@gmail.com)
+ * LME2510   (C) Leaguerme (Shenzhen) MicroElectronics Co., Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation, version 2.
+ *
+ *
+ * see Documentation/dvb/README.dvb-usb for more information
+ *
+ * Known Issue :
+ * Non Intel USB chipsets fail to maintain High Speed on Boot or Hot Plug
+ *
+  */
+#define DVB_USB_LOG_PREFIX "LME2510"
+#include 
+#include 
+#include "dvb-usb.h"
+#include "lmedm04.h"
+#include "tda826x.h"
+#include "tda10086.h"
+
+/* debug */
+static int dvb_usb_lme2510_debug;
+#define l_dprintk(var, level, args...) \
+   do { if ((var >= level)) info(args);  } while (0)
+#define deb_info(level, args...) l_dprintk(dvb_usb_lme2510_debug, level, args)
+#define debug_data_snipet(level, name, p) \
+deb_info(level, name" (%02x%02x%02x%02x%02x%02x%02x%02x)", \
+   *p, *(p+1), *(p+2), *(p+3), *(p+4), \
+   *(p+5), *(p+6), *(p+7));
+
+
+module_param_named(debug, dvb_usb_lme2510_debug, int, 0644);
+MODULE_PARM_DESC(debug, "set debugging level (1=info (or-able))."
+   DVB_USB_DEBUG_STATUS);
+
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
+
+struct lme2510_state {
+   u8 id;
+   u8 signal_lock;
+   u8 signal_level;
+   u8 signal_sn;
+   u8 time_key;
+   u8 i2c_talk_onoff;
+   u16 pid_table[64];
+   u8 pid_count;
+   u8 pid_flag_enable;
+   u8 filter_data[256];
+   void *buffer;
+   struct urb *lme_urb;
+
+};
+
+static int lme2510_bulk_write(struct usb_device *dev,
+   u8 *snd, int len, u8 pipe)
+{
+   int ret, actual_l;
+   ret = usb_bulk_msg(dev, usb_sndbulkpipe(dev, pipe),
+   snd, len , &actual_l, 500);
+   return ret;
+}
+
+static int lme2510_bulk_read(struct usb_device *dev,
+   u8 *rev, int len, u8 pipe)
+{
+   int ret, actual_l;
+   ret = usb_bulk_msg(dev, usb_rcvbulkpipe(dev, pipe),
+rev, len , &actual_l, 500);
+   return ret;
+}
+
+static int lme2510_usb_talk(struct dvb_usb_device *d,
+   u8 *wbuf, int wlen, u8 *rbuf, int rlen)
+{
+   u8 s[wlen+4], r[rlen+4];
+   int ret = 0;
+   memset(s, 0, wlen);
+   memset(r, 0, rlen);
+   memcpy(&s[0], wbuf, wlen);
+
+   ret = mutex_lock_interruptible(&d->usb_mutex);
+
+   if (ret < 0)
+   return -EAGAIN;
+
+   ret += usb_clear_halt(d->udev, usb_sndbulkpipe(d->udev, 0x01));
+   msleep(5);
+   ret += lme2510_bulk_write(d->udev, s, wlen , 0x1);
+
+   msleep(5);
+   ret += usb_cle