diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-07-10 12:25:48 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-07-27 16:55:51 -0400 |
commit | 7558977a4ade512648bdfcc5f74dfffd7511d46f (patch) | |
tree | 2f90bcbd231fb306071bfe57b628dc31fa8de3a1 /drivers/media/dvb/frontends | |
parent | f1b829704c0b48daff99056932855e71c2814855 (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/frontends')
-rw-r--r-- | drivers/media/dvb/frontends/drxk_hard.c | 43 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/drxk_hard.h | 2 |
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, | |||
1521 | unsigned long end; | 1521 | unsigned long end; |
1522 | u8 buffer[34]; | 1522 | u8 buffer[34]; |
1523 | int cnt = 0, ii; | 1523 | int cnt = 0, ii; |
1524 | const char *p; | ||
1525 | char errname[30]; | ||
1524 | 1526 | ||
1525 | dprintk(1, "\n"); | 1527 | dprintk(1, "\n"); |
1526 | 1528 | ||
@@ -1567,31 +1569,36 @@ static int scu_command(struct drxk_state *state, | |||
1567 | 1569 | ||
1568 | /* Check if an error was reported by SCU */ | 1570 | /* Check if an error was reported by SCU */ |
1569 | err = (s16)result[0]; | 1571 | err = (s16)result[0]; |
1572 | if (err >= 0) | ||
1573 | goto error; | ||
1570 | 1574 | ||
1571 | /* check a few fixed error codes */ | 1575 | /* check for the known error codes */ |
1572 | if (err == SCU_RESULT_UNKSTD) { | 1576 | switch (err) { |
1573 | printk(KERN_ERR "drxk: SCU_RESULT_UNKSTD\n"); | 1577 | case SCU_RESULT_UNKCMD: |
1574 | status = -EINVAL; | 1578 | p = "SCU_RESULT_UNKCMD"; |
1575 | goto error2; | 1579 | break; |
1576 | } else if (err == SCU_RESULT_UNKCMD) { | 1580 | case SCU_RESULT_UNKSTD: |
1577 | printk(KERN_ERR "drxk: SCU_RESULT_UNKCMD\n"); | 1581 | p = "SCU_RESULT_UNKSTD"; |
1578 | status = -EINVAL; | 1582 | break; |
1579 | goto error2; | 1583 | case SCU_RESULT_SIZE: |
1580 | } else if (err < 0) { | 1584 | p = "SCU_RESULT_SIZE"; |
1581 | /* | 1585 | break; |
1582 | * here it is assumed that a nagative result means | 1586 | case SCU_RESULT_INVPAR: |
1583 | * error, and positive no error | 1587 | p = "SCU_RESULT_INVPAR"; |
1584 | */ | 1588 | break; |
1585 | printk(KERN_ERR "drxk: %s ERROR: %d\n", __func__, err); | 1589 | default: /* Other negative values are errors */ |
1586 | status = -EINVAL; | 1590 | sprintf(errname, "ERROR: %d\n", err); |
1587 | goto error2; | 1591 | p = errname; |
1588 | } | 1592 | } |
1593 | printk(KERN_ERR "drxk: %s while sending cmd 0x%04x with params:", p, cmd); | ||
1594 | print_hex_dump_bytes("drxk: ", DUMP_PREFIX_NONE, buffer, cnt); | ||
1595 | status = -EINVAL; | ||
1596 | goto error2; | ||
1589 | } | 1597 | } |
1590 | 1598 | ||
1591 | error: | 1599 | error: |
1592 | if (status < 0) | 1600 | if (status < 0) |
1593 | printk(KERN_ERR "drxk: Error %d on %s\n", status, __func__); | 1601 | printk(KERN_ERR "drxk: Error %d on %s\n", status, __func__); |
1594 | |||
1595 | error2: | 1602 | error2: |
1596 | mutex_unlock(&state->mutex); | 1603 | mutex_unlock(&state->mutex); |
1597 | return status; | 1604 | 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 @@ | |||
20 | #define DRX_SCU_READY 0 | 20 | #define DRX_SCU_READY 0 |
21 | #define DRXK_MAX_WAITTIME (200) | 21 | #define DRXK_MAX_WAITTIME (200) |
22 | #define SCU_RESULT_OK 0 | 22 | #define SCU_RESULT_OK 0 |
23 | #define SCU_RESULT_SIZE -4 | ||
24 | #define SCU_RESULT_INVPAR -3 | ||
23 | #define SCU_RESULT_UNKSTD -2 | 25 | #define SCU_RESULT_UNKSTD -2 |
24 | #define SCU_RESULT_UNKCMD -1 | 26 | #define SCU_RESULT_UNKCMD -1 |
25 | 27 | ||