summaryrefslogtreecommitdiff
path: root/drivers/media/dvb
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2011-07-10 13:25:48 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-07-27 17:55:51 -0300
commit7558977a4ade512648bdfcc5f74dfffd7511d46f (patch)
tree2f90bcbd231fb306071bfe57b628dc31fa8de3a1 /drivers/media/dvb
parentf1b829704c0b48daff99056932855e71c2814855 (diff)
[media] drxk: Improve the scu_command error message
Now, it outputs: [10927.639641] drxk: SCU_RESULT_INVPAR while sending cmd 0x0203 with params: [10927.646283] drxk: 02 00 00 00 10 00 07 00 03 02 .......... Better than ERROR -3. This happens with Terratec H5 firmware. It adds 2 new error conditions, and something useful to track what the heck is that. I suspect that the scu_command is dependent on the firmware revision. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/frontends/drxk_hard.c43
-rw-r--r--drivers/media/dvb/frontends/drxk_hard.h2
2 files changed, 27 insertions, 18 deletions
diff --git a/drivers/media/dvb/frontends/drxk_hard.c b/drivers/media/dvb/frontends/drxk_hard.c
index bb8627ffae73..5745f526f391 100644
--- a/drivers/media/dvb/frontends/drxk_hard.c
+++ b/drivers/media/dvb/frontends/drxk_hard.c
@@ -1521,6 +1521,8 @@ static int scu_command(struct drxk_state *state,
unsigned long end;
u8 buffer[34];
int cnt = 0, ii;
+ const char *p;
+ char errname[30];
dprintk(1, "\n");
@@ -1567,31 +1569,36 @@ static int scu_command(struct drxk_state *state,
/* Check if an error was reported by SCU */
err = (s16)result[0];
+ if (err >= 0)
+ goto error;
- /* check a few fixed error codes */
- if (err == SCU_RESULT_UNKSTD) {
- printk(KERN_ERR "drxk: SCU_RESULT_UNKSTD\n");
- status = -EINVAL;
- goto error2;
- } else if (err == SCU_RESULT_UNKCMD) {
- printk(KERN_ERR "drxk: SCU_RESULT_UNKCMD\n");
- status = -EINVAL;
- goto error2;
- } else if (err < 0) {
- /*
- * here it is assumed that a nagative result means
- * error, and positive no error
- */
- printk(KERN_ERR "drxk: %s ERROR: %d\n", __func__, err);
- status = -EINVAL;
- goto error2;
+ /* check for the known error codes */
+ switch (err) {
+ case SCU_RESULT_UNKCMD:
+ p = "SCU_RESULT_UNKCMD";
+ break;
+ case SCU_RESULT_UNKSTD:
+ p = "SCU_RESULT_UNKSTD";
+ break;
+ case SCU_RESULT_SIZE:
+ p = "SCU_RESULT_SIZE";
+ break;
+ case SCU_RESULT_INVPAR:
+ p = "SCU_RESULT_INVPAR";
+ break;
+ default: /* Other negative values are errors */
+ sprintf(errname, "ERROR: %d\n", err);
+ p = errname;
}
+ printk(KERN_ERR "drxk: %s while sending cmd 0x%04x with params:", p, cmd);
+ print_hex_dump_bytes("drxk: ", DUMP_PREFIX_NONE, buffer, cnt);
+ status = -EINVAL;
+ goto error2;
}
error:
if (status < 0)
printk(KERN_ERR "drxk: Error %d on %s\n", status, __func__);
-
error2:
mutex_unlock(&state->mutex);
return status;
diff --git a/drivers/media/dvb/frontends/drxk_hard.h b/drivers/media/dvb/frontends/drxk_hard.h
index a20a19d9aff6..a05c32eecdcc 100644
--- a/drivers/media/dvb/frontends/drxk_hard.h
+++ b/drivers/media/dvb/frontends/drxk_hard.h
@@ -20,6 +20,8 @@
#define DRX_SCU_READY 0
#define DRXK_MAX_WAITTIME (200)
#define SCU_RESULT_OK 0
+#define SCU_RESULT_SIZE -4
+#define SCU_RESULT_INVPAR -3
#define SCU_RESULT_UNKSTD -2
#define SCU_RESULT_UNKCMD -1