[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>
This commit is contained in:
parent
f1b829704c
commit
7558977a4a
2 changed files with 27 additions and 18 deletions
|
@ -1521,6 +1521,8 @@ static int scu_command(struct drxk_state *state,
|
||||||
unsigned long end;
|
unsigned long end;
|
||||||
u8 buffer[34];
|
u8 buffer[34];
|
||||||
int cnt = 0, ii;
|
int cnt = 0, ii;
|
||||||
|
const char *p;
|
||||||
|
char errname[30];
|
||||||
|
|
||||||
dprintk(1, "\n");
|
dprintk(1, "\n");
|
||||||
|
|
||||||
|
@ -1567,31 +1569,36 @@ static int scu_command(struct drxk_state *state,
|
||||||
|
|
||||||
/* Check if an error was reported by SCU */
|
/* Check if an error was reported by SCU */
|
||||||
err = (s16)result[0];
|
err = (s16)result[0];
|
||||||
|
if (err >= 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
/* check a few fixed error codes */
|
/* check for the known error codes */
|
||||||
if (err == SCU_RESULT_UNKSTD) {
|
switch (err) {
|
||||||
printk(KERN_ERR "drxk: SCU_RESULT_UNKSTD\n");
|
case SCU_RESULT_UNKCMD:
|
||||||
status = -EINVAL;
|
p = "SCU_RESULT_UNKCMD";
|
||||||
goto error2;
|
break;
|
||||||
} else if (err == SCU_RESULT_UNKCMD) {
|
case SCU_RESULT_UNKSTD:
|
||||||
printk(KERN_ERR "drxk: SCU_RESULT_UNKCMD\n");
|
p = "SCU_RESULT_UNKSTD";
|
||||||
status = -EINVAL;
|
break;
|
||||||
goto error2;
|
case SCU_RESULT_SIZE:
|
||||||
} else if (err < 0) {
|
p = "SCU_RESULT_SIZE";
|
||||||
/*
|
break;
|
||||||
* here it is assumed that a nagative result means
|
case SCU_RESULT_INVPAR:
|
||||||
* error, and positive no error
|
p = "SCU_RESULT_INVPAR";
|
||||||
*/
|
break;
|
||||||
printk(KERN_ERR "drxk: %s ERROR: %d\n", __func__, err);
|
default: /* Other negative values are errors */
|
||||||
status = -EINVAL;
|
sprintf(errname, "ERROR: %d\n", err);
|
||||||
goto error2;
|
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:
|
error:
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
printk(KERN_ERR "drxk: Error %d on %s\n", status, __func__);
|
printk(KERN_ERR "drxk: Error %d on %s\n", status, __func__);
|
||||||
|
|
||||||
error2:
|
error2:
|
||||||
mutex_unlock(&state->mutex);
|
mutex_unlock(&state->mutex);
|
||||||
return status;
|
return status;
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
#define DRX_SCU_READY 0
|
#define DRX_SCU_READY 0
|
||||||
#define DRXK_MAX_WAITTIME (200)
|
#define DRXK_MAX_WAITTIME (200)
|
||||||
#define SCU_RESULT_OK 0
|
#define SCU_RESULT_OK 0
|
||||||
|
#define SCU_RESULT_SIZE -4
|
||||||
|
#define SCU_RESULT_INVPAR -3
|
||||||
#define SCU_RESULT_UNKSTD -2
|
#define SCU_RESULT_UNKSTD -2
|
||||||
#define SCU_RESULT_UNKCMD -1
|
#define SCU_RESULT_UNKCMD -1
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue