firedtv: refine AVC debugging
Hi,
I gave this some thought when I implemented it. These are "should not happend"-situations where the drivers or hardware sends unknown/unimplemented commands. Rather than making sure that they are never seen in the logs I wanted them to always be logged (as long as some debug logging is turned on) since they indicate driver/hw problems.
Do you disagree with my reasoning? I guess that the best would be to make sure that all unknown messages are always logged as warnings with their full content.
Regarding your other comment, I will fix that in the next patch version.
Regards,
Henrik
Quoted 6 lines
Review
Quoted 5 lines · Henrik Kurelid
(quoted diff) +5
-0+static int debug_fcp_opcode_flag_set(unsigned int opcode, + const u8 *data, int length) +{ + switch (opcode) { + case AVC_OPCODE_VENDOR: break; + case AVC_OPCODE_READ_DESCRIPTOR: return avc_debug & AVC_DEBUG_READ_DESCRIPTOR; + case AVC_OPCODE_DSIT:
return avc_debug & AVC_DEBUG_DSIT; + case AVC_OPCODE_DSD: return avc_debug & AVC_DEBUG_DSD; + default:
return 1;
Quoted 10 lines
Review
Quoted 10 lines
(quoted diff) +10
-0+ } + + if (length < 7 || + data[3] != SFE_VENDOR_DE_COMPANYID_0 || + data[4] != SFE_VENDOR_DE_COMPANYID_1 || + data[5] != SFE_VENDOR_DE_COMPANYID_2) + return 1; + + switch (data[6]) { + case SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL: return avc_debug & AVC_DEBUG_REGISTER_REMOTE_CONTROL; + case
SFE_VENDOR_OPCODE_LNB_CONTROL: return avc_debug & AVC_DEBUG_LNB_CONTROL; + case SFE_VENDOR_OPCODE_TUNE_QPSK:
return avc_debug & AVC_DEBUG_TUNE_QPSK; + case SFE_VENDOR_OPCODE_TUNE_QPSK2: return avc_debug & AVC_DEBUG_TUNE_QPSK2; +
case SFE_VENDOR_OPCODE_HOST2CA: return avc_debug & AVC_DEBUG_HOST2CA; + case SFE_VENDOR_OPCODE_CA2HOST:
return avc_debug & AVC_DEBUG_CA2HOST; + }
Quoted 25 lines
Quoted 4 lines
(quoted diff) +3
-0+ return 1; +} + static void debug_fcp(const u8 *data, int length)Review
Quoted 10 lines
(quoted diff) +2
-4{ unsigned int subunit_type, subunit_id, op; const char *prefix = data[0] > 7 ? "FCP <- " : "FCP -> "; - if (avc_debug & AVC_DEBUG_FCP_SUBACTIONS) { - subunit_type = data[1] >> 3; - subunit_id = data[1] & 7; - op = subunit_type == 0x1e || subunit_id == 5 ? ~0 : data[2]; + subunit_type = data[1] >> 3; + subunit_id = data[1] & 7; + op = subunit_type == 0x1e || subunit_id == 5 ? ~0 : data[2]; + if (debug_fcp_opcode_flag_set(op, data, length)) { printk(KERN_INFO "%ssu=%x.%x l=%d: %-8s - %s\n",[...]
Shouldn't the three return statements in
debug_fcp_opcode_flag_setbe 'return 0' rather than one?
--
Stefan Richter
-=====-==--= -=== =---=
http://arcgraph.de/sr/
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
On 17 Jul, Henrik Kurelid wrote:
[I wrote]
Quoted 7 lines
Quoted 2 lines
Shouldn't the three return statements in
debug_fcp_opcode_flag_setbe 'return 0' rather than one?I gave this some thought when I implemented it. These are "should not happend"-situations where the drivers or hardware sends unknown/ unimplemented commands. Rather than making sure that they are never seen in the logs I wanted them to always be logged (as long as some debug logging is turned on) since they indicate driver/hw problems.
Ah, that's why. Could be documented:
static int debug_fcp_opcode_flag_set(unsigned int opcode,
const u8 *data, int length)
{
switch (opcode) {
case AVC_OPCODE_VENDOR: break;
case AVC_OPCODE_READ_DESCRIPTOR: return avc_debug & AVC_DEBUG_READ_DESCRIPTOR;
case AVC_OPCODE_DSIT: return avc_debug & AVC_DEBUG_DSIT;
case AVC_OPCODE_DSD: return avc_debug & AVC_DEBUG_DSD;
default: goto unknown_opcode;
}
if (length < 7 ||
data[3] != SFE_VENDOR_DE_COMPANYID_0 ||
data[4] != SFE_VENDOR_DE_COMPANYID_1 ||
data[5] != SFE_VENDOR_DE_COMPANYID_2)
goto unknown_opcode;
switch (data[6]) {
case SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL: return avc_debug & AVC_DEBUG_REGISTER_REMOTE_CONTROL;
case SFE_VENDOR_OPCODE_LNB_CONTROL: return avc_debug & AVC_DEBUG_LNB_CONTROL;
case SFE_VENDOR_OPCODE_TUNE_QPSK: return avc_debug & AVC_DEBUG_TUNE_QPSK;
case SFE_VENDOR_OPCODE_TUNE_QPSK2: return avc_debug & AVC_DEBUG_TUNE_QPSK2;
case SFE_VENDOR_OPCODE_HOST2CA: return avc_debug & AVC_DEBUG_HOST2CA;
case SFE_VENDOR_OPCODE_CA2HOST: return avc_debug & AVC_DEBUG_CA2HOST;
}unknown_opcode: /* should never happen, log it */
return 1; }
By the way, from here it looks as if your MUA converted tabs to spaces. In your other patch too.
Signature · 3 lines
Stefan Richter -=====-==--= -=== =---= http://arcgraph.de/sr/
On 17 Jul, Henrik Kurelid wrote:
[I wrote]
Quoted 7 lines
Quoted 2 lines
Shouldn't the three return statements in
debug_fcp_opcode_flag_setbe 'return 0' rather than one?I gave this some thought when I implemented it. These are "should not happend"-situations where the drivers or hardware sends unknown/ unimplemented commands. Rather than making sure that they are never seen in the logs I wanted them to always be logged (as long as some debug logging is turned on) since they indicate driver/hw problems.
Ah, that's why. Could be documented:
static int debug_fcp_opcode_flag_set(unsigned int opcode,
const u8 *data, int length)
{
switch (opcode) {
case AVC_OPCODE_VENDOR: break;
case AVC_OPCODE_READ_DESCRIPTOR: return avc_debug & AVC_DEBUG_READ_DESCRIPTOR;
case AVC_OPCODE_DSIT: return avc_debug & AVC_DEBUG_DSIT;
case AVC_OPCODE_DSD: return avc_debug & AVC_DEBUG_DSD;
default: goto unknown_opcode;
}
if (length < 7 ||
data[3] != SFE_VENDOR_DE_COMPANYID_0 ||
data[4] != SFE_VENDOR_DE_COMPANYID_1 ||
data[5] != SFE_VENDOR_DE_COMPANYID_2)
goto unknown_opcode;
switch (data[6]) {
case SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL: return avc_debug & AVC_DEBUG_REGISTER_REMOTE_CONTROL;
case SFE_VENDOR_OPCODE_LNB_CONTROL: return avc_debug & AVC_DEBUG_LNB_CONTROL;
case SFE_VENDOR_OPCODE_TUNE_QPSK: return avc_debug & AVC_DEBUG_TUNE_QPSK;
case SFE_VENDOR_OPCODE_TUNE_QPSK2: return avc_debug & AVC_DEBUG_TUNE_QPSK2;
case SFE_VENDOR_OPCODE_HOST2CA: return avc_debug & AVC_DEBUG_HOST2CA;
case SFE_VENDOR_OPCODE_CA2HOST: return avc_debug & AVC_DEBUG_CA2HOST;
}unknown_opcode: /* should never happen, log it */
return 1; }
By the way, from here it looks as if your MUA converted tabs to spaces. In your other patch too.
Signature · 3 lines
Stefan Richter -=====-==--= -=== =---= http://arcgraph.de/sr/
On 17 Jul, Henrik Kurelid wrote:
[I wrote]
Quoted 7 lines
Quoted 2 lines
Shouldn't the three return statements in
debug_fcp_opcode_flag_setbe 'return 0' rather than one?I gave this some thought when I implemented it. These are "should not happend"-situations where the drivers or hardware sends unknown/ unimplemented commands. Rather than making sure that they are never seen in the logs I wanted them to always be logged (as long as some debug logging is turned on) since they indicate driver/hw problems.
Ah, that's why. Could be documented:
static int debug_fcp_opcode_flag_set(unsigned int opcode,
const u8 *data, int length)
{
switch (opcode) {
case AVC_OPCODE_VENDOR: break;
case AVC_OPCODE_READ_DESCRIPTOR: return avc_debug & AVC_DEBUG_READ_DESCRIPTOR;
case AVC_OPCODE_DSIT: return avc_debug & AVC_DEBUG_DSIT;
case AVC_OPCODE_DSD: return avc_debug & AVC_DEBUG_DSD;
default: goto unknown_opcode;
}
if (length < 7 ||
data[3] != SFE_VENDOR_DE_COMPANYID_0 ||
data[4] != SFE_VENDOR_DE_COMPANYID_1 ||
data[5] != SFE_VENDOR_DE_COMPANYID_2)
goto unknown_opcode;
switch (data[6]) {
case SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL: return avc_debug & AVC_DEBUG_REGISTER_REMOTE_CONTROL;
case SFE_VENDOR_OPCODE_LNB_CONTROL: return avc_debug & AVC_DEBUG_LNB_CONTROL;
case SFE_VENDOR_OPCODE_TUNE_QPSK: return avc_debug & AVC_DEBUG_TUNE_QPSK;
case SFE_VENDOR_OPCODE_TUNE_QPSK2: return avc_debug & AVC_DEBUG_TUNE_QPSK2;
case SFE_VENDOR_OPCODE_HOST2CA: return avc_debug & AVC_DEBUG_HOST2CA;
case SFE_VENDOR_OPCODE_CA2HOST: return avc_debug & AVC_DEBUG_CA2HOST;
}unknown_opcode: /* should never happen, log it */
return 1; }
By the way, from here it looks as if your MUA converted tabs to spaces. In your other patch too.
Signature · 3 lines
Stefan Richter -=====-==--= -=== =---= http://arcgraph.de/sr/
On 17 Jul, Henrik Kurelid wrote:
[I wrote]
Quoted 7 lines
Quoted 2 lines
Shouldn't the three return statements in
debug_fcp_opcode_flag_setbe 'return 0' rather than one?I gave this some thought when I implemented it. These are "should not happend"-situations where the drivers or hardware sends unknown/ unimplemented commands. Rather than making sure that they are never seen in the logs I wanted them to always be logged (as long as some debug logging is turned on) since they indicate driver/hw problems.
Ah, that's why. Could be documented:
static int debug_fcp_opcode_flag_set(unsigned int opcode,
const u8 *data, int length)
{
switch (opcode) {
case AVC_OPCODE_VENDOR: break;
case AVC_OPCODE_READ_DESCRIPTOR: return avc_debug & AVC_DEBUG_READ_DESCRIPTOR;
case AVC_OPCODE_DSIT: return avc_debug & AVC_DEBUG_DSIT;
case AVC_OPCODE_DSD: return avc_debug & AVC_DEBUG_DSD;
default: goto unknown_opcode;
}
if (length < 7 ||
data[3] != SFE_VENDOR_DE_COMPANYID_0 ||
data[4] != SFE_VENDOR_DE_COMPANYID_1 ||
data[5] != SFE_VENDOR_DE_COMPANYID_2)
goto unknown_opcode;
switch (data[6]) {
case SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL: return avc_debug & AVC_DEBUG_REGISTER_REMOTE_CONTROL;
case SFE_VENDOR_OPCODE_LNB_CONTROL: return avc_debug & AVC_DEBUG_LNB_CONTROL;
case SFE_VENDOR_OPCODE_TUNE_QPSK: return avc_debug & AVC_DEBUG_TUNE_QPSK;
case SFE_VENDOR_OPCODE_TUNE_QPSK2: return avc_debug & AVC_DEBUG_TUNE_QPSK2;
case SFE_VENDOR_OPCODE_HOST2CA: return avc_debug & AVC_DEBUG_HOST2CA;
case SFE_VENDOR_OPCODE_CA2HOST: return avc_debug & AVC_DEBUG_CA2HOST;
}unknown_opcode: /* should never happen, log it */
return 1; }
By the way, from here it looks as if your MUA converted tabs to spaces. In your other patch too.
Signature · 3 lines
Stefan Richter -=====-==--= -=== =---= http://arcgraph.de/sr/
PATCH 1/3 firedtv: add PID filtering for SW zigzag retune
From: Henrik Kurelid <[email protected]>
The AVC protocol uses the same command for tuning and PID filtering and since dvb-core uses a software zigzagging to do automatic retuning this could cause all PID filters to be cleared. PID filter information is now included in all DSD commands to the card.
Background:
There is a problem in the firedtv driver that causes recordings to stop if the SW zigzag algorithm in dvb-core kicks in with a retune after the application has set up the PID filters. Since tuning and setting PID filters uses the same AVC command (DSD) and only the replace subfunction is supported by the card, it is not possible to do a retune without setting the PID filters. This means that the PID filtering has to be sent in each tune.
This problem applies to C and T cards since S and S2 cards tune using a vendor specific command. The patch corrects the problem by sending the PID list in each tune. I have tested it on my T card with a good result.
How to trigger problem: Zap to a channel and output AV to a file, e.g. "tzap -c channels.conf SVT1 -r -o SVT1.ts". After a short while, pull the antenna cable from the card. The lock on the channel will disappear and the TS file will stop increasing in size. Wait a couple of seconds. Replug the cable again. You will get a lock on the channel again, but the TS file will never increase in size agains sinze no PIDS are filtered.
Tested with kaffeine with DVB-T and DVB-C: Fixes retuning after antenna was plugged out and back in with DVB-T. Does not fix this with DVB-C, but also doesn't regress on DVB-C.
---
Update (Stefan R):
Make a function static, small whitespace changes, extended changelog.
drivers/media/dvb/firewire/firedtv-avc.c | 40 +++++++++++++++++------ 1 file changed, 30 insertions(+), 10 deletions(-)
drivers/media/dvb/firewire/firedtv-avc.c +30 -10
@@ -254,6 +254,26 @@ int avc_recv(struct firedtv *fdtv, voidreturn 0 ; } +static int add_pid_filter (struct firedtv *fdtv,u8 *operand) +{ +int i, n, pos =1 ; + +for (i =0 , n =0 ; i <16 ; i++) { +if (test_bit (i, &fdtv->channel_active)) { + operand[pos++] =0x13 ;/* flowfunction relay */ + operand[pos++] =0x80 ;/* dsd_sel_spec_valid_flags -> PID */ + operand[pos++] = (fdtv->channel_pid[i] >>8 ) &0x1f ; + operand[pos++] = fdtv->channel_pid[i] &0xff ; + operand[pos++] =0x00 ;/* tableID */ + operand[pos++] =0x00 ;/* filter_length */ + n++; + } + } + operand[0 ] = n; + +return pos; +} +/* * tuning command for setting the relative LNB frequency * (not supported by the AVC standard)
@@ -316,7 +336,8 @@ static void avc_tuner_tuneqpsk(struct fi } } -static void avc_tuner_dsd_dvb_c (struct dvb_frontend_parameters *params, +static void avc_tuner_dsd_dvb_c (struct firedtv *fdtv, +struct dvb_frontend_parameters *params,struct avc_command_frame *c) { c->opcode =AVC_OPCODE_DSD ;
@@ -378,13 +399,13 @@ static void avc_tuner_dsd_dvb_c(struct d c->operand[20 ] =0x00 ; c->operand[21 ] =0x00 ; -/* Nr_of_dsd_sel_specs = 0 -> no PIDs are transmitted */ - c->operand[22 ] =0x00 ; - c->length =28 ; +/* Add PIDs to filter */ + c->length =ALIGN (22 +add_pid_filter (fdtv, &c->operand[22 ]) +3 ,4 ); } -static void avc_tuner_dsd_dvb_t (struct dvb_frontend_parameters *params, +static void avc_tuner_dsd_dvb_t (struct firedtv *fdtv, +struct dvb_frontend_parameters *params,struct avc_command_frame *c) {struct dvb_ofdm_parameters *ofdm = ¶ms->u.ofdm;
@@ -481,10 +502,9 @@ static void avc_tuner_dsd_dvb_t(struct d c->operand[15 ] =0x00 ;/* network_ID[0] */ c->operand[16 ] =0x00 ;/* network_ID[1] */ -/* Nr_of_dsd_sel_specs = 0 -> no PIDs are transmitted */ - c->operand[17 ] =0x00 ; - c->length =24 ; +/* Add PIDs to filter */ + c->length =ALIGN (17 +add_pid_filter (fdtv, &c->operand[17 ]) +3 ,4 ); } int avc_tuner_dsd(struct firedtv *fdtv,
@@ -502,8 +522,8 @@ int avc_tuner_dsd(struct firedtv *fdtv,switch (fdtv->type) {case FIREDTV_DVB_S :case FIREDTV_DVB_S2 :avc_tuner_tuneqpsk (fdtv, params, c);break ; -case FIREDTV_DVB_C :avc_tuner_dsd_dvb_c (params, c);break ; -case FIREDTV_DVB_T :avc_tuner_dsd_dvb_t (params, c);break ; +case FIREDTV_DVB_C :avc_tuner_dsd_dvb_c (fdtv, params, c);break ; +case FIREDTV_DVB_T :avc_tuner_dsd_dvb_t (fdtv, params, c);break ;default :BUG (); }
Signature · 3 lines
Stefan Richter -=====-==--= =--- ----= http://arcgraph.de/sr/
PATCH 2/3 firedtv: refine AVC debugging
From: Henrik Kurelid <[email protected]>
The current AVC debugging can clog the log down a lot since many applications tend to check the signal strength very often. This patch enables users to select which AVC messages to log using a bitmask. In addition, it also enables the possibility to debug application PMTs sent to the driver. This will be usable since the CA support is still poorly tested for lots of CAMs and CA systems.
---
Update (Stefan R):
Remove pre 2.6.22 compatibility #ifdefs, small whitespace changes.
drivers/media/dvb/firewire/firedtv-avc.c | 79 ++++++++++++++++++++--- 1 file changed, 67 insertions(+), 12 deletions(-)
drivers/media/dvb/firewire/firedtv-avc.c +67 -12
@@ -89,14 +89,31 @@ struct avc_response_frame {u8 operand[509 ]; }; -#define AVC_DEBUG_FCP_SUBACTIONS 1 -#define AVC_DEBUG_FCP_PAYLOADS 2 +#define AVC_DEBUG_READ_DESCRIPTOR 0x0001 +#define AVC_DEBUG_DSIT 0x0002 +#define AVC_DEBUG_DSD 0x0004 +#define AVC_DEBUG_REGISTER_REMOTE_CONTROL 0x0008 +#define AVC_DEBUG_LNB_CONTROL 0x0010 +#define AVC_DEBUG_TUNE_QPSK 0x0020 +#define AVC_DEBUG_TUNE_QPSK2 0x0040 +#define AVC_DEBUG_HOST2CA 0x0080 +#define AVC_DEBUG_CA2HOST 0x0100 +#define AVC_DEBUG_APPLICATION_PMT 0x4000 +#define AVC_DEBUG_FCP_PAYLOADS 0x8000static int avc_debug;module_param_named (debug, avc_debug, int,0644 ); -MODULE_PARM_DESC (debug,"Verbose logging (default = 0" -", FCP subactions = " __stringify(AVC_DEBUG_FCP_SUBACTIONS ) - ", FCP payloads = " __stringify(AVC_DEBUG_FCP_PAYLOADS) +MODULE_PARM_DESC(debug, "Verbose logging bitmask (none (default) = 0" + ", FCP subaction(READ DESCRIPTOR) = " __stringify(AVC_DEBUG_READ_DESCRIPTOR) + ", FCP subaction(DSIT) = " __stringify(AVC_DEBUG_DSIT) + ", FCP subaction(REGISTER_REMOTE_CONTROL) = " __stringify(AVC_DEBUG_REGISTER_REMOTE_CONTROL) + ", FCP subaction(LNB CONTROL) = " __stringify(AVC_DEBUG_LNB_CONTROL) + ", FCP subaction(TUNE QPSK) = " __stringify(AVC_DEBUG_TUNE_QPSK) + ", FCP subaction(TUNE QPSK2) = " __stringify(AVC_DEBUG_TUNE_QPSK2) + ", FCP subaction(HOST2CA) = " __stringify(AVC_DEBUG_HOST2CA) + ", FCP subaction(CA2HOST) = " __stringify(AVC_DEBUG_CA2HOST) + ", Application sent PMT = " __stringify(AVC_DEBUG_APPLICATION_PMT) + ", FCP payloads(for selected subactions) = " __stringify(AVC_DEBUG_FCP_PAYLOADS)", or all = -1)" );static const char *debug_fcp_ctype (unsigned int ctype)
@@ -142,26 +159,61 @@ static const char *debug_fcp_opcode(unsireturn "Vendor" ; } +static int debug_fcp_opcode_flag_set (unsigned int opcode, +const u8 *data,int length) +{ +switch (opcode) { +case AVC_OPCODE_VENDOR :break ; +case AVC_OPCODE_READ_DESCRIPTOR :return avc_debug &AVC_DEBUG_READ_DESCRIPTOR ; +case AVC_OPCODE_DSIT :return avc_debug &AVC_DEBUG_DSIT ; +case AVC_OPCODE_DSD :return avc_debug &AVC_DEBUG_DSD ; +default :return 1 ; + } + +if (length <7 || + data[3 ] !=SFE_VENDOR_DE_COMPANYID_0 || + data[4 ] !=SFE_VENDOR_DE_COMPANYID_1 || + data[5 ] !=SFE_VENDOR_DE_COMPANYID_2 ) +return 1 ; + +switch (data[6 ]) { +case SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL :return avc_debug &AVC_DEBUG_REGISTER_REMOTE_CONTROL ; +case SFE_VENDOR_OPCODE_LNB_CONTROL :return avc_debug &AVC_DEBUG_LNB_CONTROL ; +case SFE_VENDOR_OPCODE_TUNE_QPSK :return avc_debug &AVC_DEBUG_TUNE_QPSK ; +case SFE_VENDOR_OPCODE_TUNE_QPSK2 :return avc_debug &AVC_DEBUG_TUNE_QPSK2 ; +case SFE_VENDOR_OPCODE_HOST2CA :return avc_debug &AVC_DEBUG_HOST2CA ; +case SFE_VENDOR_OPCODE_CA2HOST :return avc_debug &AVC_DEBUG_CA2HOST ; + } +return 1 ; +} +static void debug_fcp (const u8 *data,int length) {unsigned int subunit_type, subunit_id, op;const char *prefix = data[0 ] >7 ?"FCP <- " :"FCP -> " ; -if (avc_debug &AVC_DEBUG_FCP_SUBACTIONS ) { - subunit_type = data[1 ] >>3 ; - subunit_id = data[1 ] &7 ; - op = subunit_type ==0x1e || subunit_id ==5 ? ~0 : data[2 ]; + subunit_type = data[1 ] >>3 ; + subunit_id = data[1 ] &7 ; + op = subunit_type ==0x1e || subunit_id ==5 ? ~0 : data[2 ]; +if (debug_fcp_opcode_flag_set (op, data, length)) {printk (KERN_INFO "%ssu=%x.%x l=%d: %-8s - %s\n" , prefix, subunit_type, subunit_id, length,debug_fcp_ctype (data[0 ]),debug_fcp_opcode (op, data, length)); +if (avc_debug &AVC_DEBUG_FCP_PAYLOADS ) +print_hex_dump (KERN_INFO , prefix,DUMP_PREFIX_NONE , +16 ,1 , data, length, false); } +} -if (avc_debug &AVC_DEBUG_FCP_PAYLOADS ) -print_hex_dump (KERN_INFO , prefix,DUMP_PREFIX_NONE ,16 ,1 , - data, length, false); +static void debug_pmt (char *msg,int length) +{ +printk (KERN_INFO "APP PMT -> l=%d\n" , length); +print_hex_dump (KERN_INFO ,"APP PMT -> " ,DUMP_PREFIX_NONE , +16 ,1 , msg, length, false); } +static int __avc_write (struct firedtv *fdtv,const struct avc_command_frame *c,struct avc_response_frame *r) {
@@ -983,6 +1035,9 @@ int avc_ca_pmt(struct firedtv *fdtv, chaint es_info_length;int crc32_csum; +if (unlikely (avc_debug &AVC_DEBUG_APPLICATION_PMT )) +debug_pmt (msg, length); +memset (c,0 ,sizeof (*c)); c->ctype =AVC_CTYPE_CONTROL ;
Signature · 3 lines
Stefan Richter -=====-==--= =--- ----= http://arcgraph.de/sr/
PATCH 3/3 firedtv: combine some debug logging code
Shrinks source and kernel object size a bit.
--- drivers/media/dvb/firewire/firedtv-avc.c | 109 ++++++++++------------- 1 file changed, 49 insertions(+), 60 deletions(-)
drivers/media/dvb/firewire/firedtv-avc.c +49 -60
@@ -103,18 +103,19 @@ struct avc_response_frame {static int avc_debug;module_param_named (debug, avc_debug, int,0644 ); -MODULE_PARM_DESC(debug, "Verbose logging bitmask (none (default) = 0" - ", FCP subaction(READ DESCRIPTOR) = " __stringify(AVC_DEBUG_READ_DESCRIPTOR) - ", FCP subaction(DSIT) = " __stringify(AVC_DEBUG_DSIT) - ", FCP subaction(REGISTER_REMOTE_CONTROL) = " __stringify(AVC_DEBUG_REGISTER_REMOTE_CONTROL) - ", FCP subaction(LNB CONTROL) = " __stringify(AVC_DEBUG_LNB_CONTROL) - ", FCP subaction(TUNE QPSK) = " __stringify(AVC_DEBUG_TUNE_QPSK) - ", FCP subaction(TUNE QPSK2) = " __stringify(AVC_DEBUG_TUNE_QPSK2) - ", FCP subaction(HOST2CA) = " __stringify(AVC_DEBUG_HOST2CA) - ", FCP subaction(CA2HOST) = " __stringify(AVC_DEBUG_CA2HOST) - ", Application sent PMT = " __stringify(AVC_DEBUG_APPLICATION_PMT) - ", FCP payloads(for selected subactions) = " __stringify(AVC_DEBUG_FCP_PAYLOADS) -", or all = -1)" ); +MODULE_PARM_DESC (debug,"Verbose logging (none = 0" +", FCP subactions" +": READ DESCRIPTOR = " __stringify(AVC_DEBUG_READ_DESCRIPTOR ) + ", DSIT = " __stringify(AVC_DEBUG_DSIT) +" ,REGISTER_REMOTE_CONTROL =" __stringify(AVC_DEBUG_REGISTER_REMOTE_CONTROL) + ", LNB CONTROL = " __stringify(AVC_DEBUG_LNB_CONTROL) + ", TUNE QPSK = " __stringify(AVC_DEBUG_TUNE_QPSK) + ", TUNE QPSK2 = " __stringify(AVC_DEBUG_TUNE_QPSK2) +" ,HOST2CA =" __stringify(AVC_DEBUG_HOST2CA) +" ,CA2HOST =" __stringify(AVC_DEBUG_CA2HOST) + "; Application sent PMT = " __stringify(AVC_DEBUG_APPLICATION_PMT) + ", FCP payloads = " __stringify(AVC_DEBUG_FCP_PAYLOADS) + ", or a combination, or all = -1)");static const char *debug_fcp_ctype (unsigned int ctype) {
@@ -135,71 +136,59 @@ static const char *debug_fcp_opcode(unsi const u8 *data, int length) { switch (opcode) { -case AVC_OPCODE_VENDOR :break ; -case AVC_OPCODE_READ_DESCRIPTOR :return "ReadDescriptor" ; -case AVC_OPCODE_DSIT :return "DirectSelectInfo.Type" ; -case AVC_OPCODE_DSD :return "DirectSelectData" ; -default :return "?" ; - } - -if (length <7 || - data[3 ] !=SFE_VENDOR_DE_COMPANYID_0 || - data[4 ] !=SFE_VENDOR_DE_COMPANYID_1 || - data[5 ] !=SFE_VENDOR_DE_COMPANYID_2 ) -return "Vendor" ; - -switch (data[6 ]) { -case SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL :return "RegisterRC" ; -case SFE_VENDOR_OPCODE_LNB_CONTROL :return "LNBControl" ; -case SFE_VENDOR_OPCODE_TUNE_QPSK :return "TuneQPSK" ; -case SFE_VENDOR_OPCODE_TUNE_QPSK2 :return "TuneQPSK2" ; -case SFE_VENDOR_OPCODE_HOST2CA :return "Host2CA" ; -case SFE_VENDOR_OPCODE_CA2HOST :return "CA2Host" ; - } -return "Vendor" ; -} - -static int debug_fcp_opcode_flag_set (unsigned int opcode, -const u8 *data,int length) -{ -switch (opcode) { -case AVC_OPCODE_VENDOR :break ; -case AVC_OPCODE_READ_DESCRIPTOR :return avc_debug &AVC_DEBUG_READ_DESCRIPTOR ; -case AVC_OPCODE_DSIT :return avc_debug &AVC_DEBUG_DSIT ; -case AVC_OPCODE_DSD :return avc_debug &AVC_DEBUG_DSD ; -default :return 1 ; +case AVC_OPCODE_VENDOR : +break ; +case AVC_OPCODE_READ_DESCRIPTOR : +return avc_debug &AVC_DEBUG_READ_DESCRIPTOR ? +"ReadDescriptor" :NULL ; +case AVC_OPCODE_DSIT : +return avc_debug &AVC_DEBUG_DSIT ? +"DirectSelectInfo.Type" :NULL ; +case AVC_OPCODE_DSD : +return avc_debug &AVC_DEBUG_DSD ?"DirectSelectData" :NULL ; +default : +return "Unknown" ; }if (length <7 || data[3 ] !=SFE_VENDOR_DE_COMPANYID_0 || data[4 ] !=SFE_VENDOR_DE_COMPANYID_1 || data[5 ] !=SFE_VENDOR_DE_COMPANYID_2 ) -return 1 ; +return "Vendor/Unknown" ;switch (data[6 ]) { -case SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL :return avc_debug &AVC_DEBUG_REGISTER_REMOTE_CONTROL ; -case SFE_VENDOR_OPCODE_LNB_CONTROL :return avc_debug &AVC_DEBUG_LNB_CONTROL ; -case SFE_VENDOR_OPCODE_TUNE_QPSK :return avc_debug &AVC_DEBUG_TUNE_QPSK ; -case SFE_VENDOR_OPCODE_TUNE_QPSK2 :return avc_debug &AVC_DEBUG_TUNE_QPSK2 ; -case SFE_VENDOR_OPCODE_HOST2CA :return avc_debug &AVC_DEBUG_HOST2CA ; -case SFE_VENDOR_OPCODE_CA2HOST :return avc_debug &AVC_DEBUG_CA2HOST ; +case SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL : +return avc_debug &AVC_DEBUG_REGISTER_REMOTE_CONTROL ? +"RegisterRC" :NULL ; +case SFE_VENDOR_OPCODE_LNB_CONTROL : +return avc_debug &AVC_DEBUG_LNB_CONTROL ?"LNBControl" :NULL ; +case SFE_VENDOR_OPCODE_TUNE_QPSK : +return avc_debug &AVC_DEBUG_TUNE_QPSK ?"TuneQPSK" :NULL ; +case SFE_VENDOR_OPCODE_TUNE_QPSK2 : +return avc_debug &AVC_DEBUG_TUNE_QPSK2 ?"TuneQPSK2" :NULL ; +case SFE_VENDOR_OPCODE_HOST2CA : +return avc_debug &AVC_DEBUG_HOST2CA ?"Host2CA" :NULL ; +case SFE_VENDOR_OPCODE_CA2HOST : +return avc_debug &AVC_DEBUG_CA2HOST ?"CA2Host" :NULL ; } -return 1 ; +return "Vendor/Unknown" ; }static void debug_fcp (const u8 *data,int length) { -unsigned int subunit_type, subunit_id, op; -const char *prefix = data[0 ] >7 ?"FCP <- " :"FCP -> " ; +unsigned int subunit_type, subunit_id, opcode; +const char *op, *prefix; + prefix = data[0 ] >7 ?"FCP <- " :"FCP -> " ; subunit_type = data[1 ] >>3 ; - subunit_id = data[1 ] &7 ; - op = subunit_type ==0x1e || subunit_id ==5 ? ~0 : data[2 ]; -if (debug_fcp_opcode_flag_set (op, data, length)) { + subunit_id = data[1 ] &7 ; + opcode = subunit_type ==0x1e || subunit_id ==5 ? ~0 : data[2 ]; + op =debug_fcp_opcode (opcode, data, length); + +if (op) {printk (KERN_INFO "%ssu=%x.%x l=%d: %-8s - %s\n" , prefix, subunit_type, subunit_id, length, -debug_fcp_ctype (data[0 ]), -debug_fcp_opcode (op, data, length)); +debug_fcp_ctype (data[0 ]), op);if (avc_debug &AVC_DEBUG_FCP_PAYLOADS )print_hex_dump (KERN_INFO , prefix,DUMP_PREFIX_NONE ,16 ,1 , data, length, false);
Signature · 3 lines
Stefan Richter -=====-==--= =--- ----= http://arcgraph.de/sr/