aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/firewire/firedtv-avc.c
diff options
context:
space:
mode:
authorHenrik Kurelid <henke@kurelid.se>2009-08-01 07:04:06 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-09-12 11:19:38 -0400
commit15344779b28f8ba12d769a4aa62d48c9ea1f4ce5 (patch)
tree8b23824055196b1ba1962cc031d22918ef5e7afb /drivers/media/dvb/firewire/firedtv-avc.c
parent81016b496ee75cfb13d346ee58176d36a5f9c191 (diff)
V4L/DVB (12582): 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. Signed-off-by: Henrik Kurelid <henrik@kurelid.se> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/firewire/firedtv-avc.c')
-rw-r--r--drivers/media/dvb/firewire/firedtv-avc.c78
1 files changed, 66 insertions, 12 deletions
diff --git a/drivers/media/dvb/firewire/firedtv-avc.c b/drivers/media/dvb/firewire/firedtv-avc.c
index 1a94c6bb601c..570bea0dd177 100644
--- a/drivers/media/dvb/firewire/firedtv-avc.c
+++ b/drivers/media/dvb/firewire/firedtv-avc.c
@@ -89,14 +89,31 @@ struct avc_response_frame {
89 u8 operand[509]; 89 u8 operand[509];
90}; 90};
91 91
92#define AVC_DEBUG_FCP_SUBACTIONS 1 92#define AVC_DEBUG_READ_DESCRIPTOR 0x0001
93#define AVC_DEBUG_FCP_PAYLOADS 2 93#define AVC_DEBUG_DSIT 0x0002
94#define AVC_DEBUG_DSD 0x0004
95#define AVC_DEBUG_REGISTER_REMOTE_CONTROL 0x0008
96#define AVC_DEBUG_LNB_CONTROL 0x0010
97#define AVC_DEBUG_TUNE_QPSK 0x0020
98#define AVC_DEBUG_TUNE_QPSK2 0x0040
99#define AVC_DEBUG_HOST2CA 0x0080
100#define AVC_DEBUG_CA2HOST 0x0100
101#define AVC_DEBUG_APPLICATION_PMT 0x4000
102#define AVC_DEBUG_FCP_PAYLOADS 0x8000
94 103
95static int avc_debug; 104static int avc_debug;
96module_param_named(debug, avc_debug, int, 0644); 105module_param_named(debug, avc_debug, int, 0644);
97MODULE_PARM_DESC(debug, "Verbose logging (default = 0" 106MODULE_PARM_DESC(debug, "Verbose logging bitmask (none (default) = 0"
98 ", FCP subactions = " __stringify(AVC_DEBUG_FCP_SUBACTIONS) 107 ", FCP subaction(READ DESCRIPTOR) = " __stringify(AVC_DEBUG_READ_DESCRIPTOR)
99 ", FCP payloads = " __stringify(AVC_DEBUG_FCP_PAYLOADS) 108 ", FCP subaction(DSIT) = " __stringify(AVC_DEBUG_DSIT)
109 ", FCP subaction(REGISTER_REMOTE_CONTROL) = " __stringify(AVC_DEBUG_REGISTER_REMOTE_CONTROL)
110 ", FCP subaction(LNB CONTROL) = " __stringify(AVC_DEBUG_LNB_CONTROL)
111 ", FCP subaction(TUNE QPSK) = " __stringify(AVC_DEBUG_TUNE_QPSK)
112 ", FCP subaction(TUNE QPSK2) = " __stringify(AVC_DEBUG_TUNE_QPSK2)
113 ", FCP subaction(HOST2CA) = " __stringify(AVC_DEBUG_HOST2CA)
114 ", FCP subaction(CA2HOST) = " __stringify(AVC_DEBUG_CA2HOST)
115 ", Application sent PMT = " __stringify(AVC_DEBUG_APPLICATION_PMT)
116 ", FCP payloads(for selected subactions) = " __stringify(AVC_DEBUG_FCP_PAYLOADS)
100 ", or all = -1)"); 117 ", or all = -1)");
101 118
102static const char *debug_fcp_ctype(unsigned int ctype) 119static const char *debug_fcp_ctype(unsigned int ctype)
@@ -142,24 +159,58 @@ static const char *debug_fcp_opcode(unsigned int opcode,
142 return "Vendor"; 159 return "Vendor";
143} 160}
144 161
162static int debug_fcp_opcode_flag_set(unsigned int opcode,
163 const u8 *data, int length)
164{
165 switch (opcode) {
166 case AVC_OPCODE_VENDOR: break;
167 case AVC_OPCODE_READ_DESCRIPTOR: return avc_debug & AVC_DEBUG_READ_DESCRIPTOR;
168 case AVC_OPCODE_DSIT: return avc_debug & AVC_DEBUG_DSIT;
169 case AVC_OPCODE_DSD: return avc_debug & AVC_DEBUG_DSD;
170 default: return 1;
171 }
172
173 if (length < 7 ||
174 data[3] != SFE_VENDOR_DE_COMPANYID_0 ||
175 data[4] != SFE_VENDOR_DE_COMPANYID_1 ||
176 data[5] != SFE_VENDOR_DE_COMPANYID_2)
177 return 1;
178
179 switch (data[6]) {
180 case SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL: return avc_debug & AVC_DEBUG_REGISTER_REMOTE_CONTROL;
181 case SFE_VENDOR_OPCODE_LNB_CONTROL: return avc_debug & AVC_DEBUG_LNB_CONTROL;
182 case SFE_VENDOR_OPCODE_TUNE_QPSK: return avc_debug & AVC_DEBUG_TUNE_QPSK;
183 case SFE_VENDOR_OPCODE_TUNE_QPSK2: return avc_debug & AVC_DEBUG_TUNE_QPSK2;
184 case SFE_VENDOR_OPCODE_HOST2CA: return avc_debug & AVC_DEBUG_HOST2CA;
185 case SFE_VENDOR_OPCODE_CA2HOST: return avc_debug & AVC_DEBUG_CA2HOST;
186 }
187 return 1;
188}
189
145static void debug_fcp(const u8 *data, int length) 190static void debug_fcp(const u8 *data, int length)
146{ 191{
147 unsigned int subunit_type, subunit_id, op; 192 unsigned int subunit_type, subunit_id, op;
148 const char *prefix = data[0] > 7 ? "FCP <- " : "FCP -> "; 193 const char *prefix = data[0] > 7 ? "FCP <- " : "FCP -> ";
149 194
150 if (avc_debug & AVC_DEBUG_FCP_SUBACTIONS) { 195 subunit_type = data[1] >> 3;
151 subunit_type = data[1] >> 3; 196 subunit_id = data[1] & 7;
152 subunit_id = data[1] & 7; 197 op = subunit_type == 0x1e || subunit_id == 5 ? ~0 : data[2];
153 op = subunit_type == 0x1e || subunit_id == 5 ? ~0 : data[2]; 198 if (debug_fcp_opcode_flag_set(op, data, length)) {
154 printk(KERN_INFO "%ssu=%x.%x l=%d: %-8s - %s\n", 199 printk(KERN_INFO "%ssu=%x.%x l=%d: %-8s - %s\n",
155 prefix, subunit_type, subunit_id, length, 200 prefix, subunit_type, subunit_id, length,
156 debug_fcp_ctype(data[0]), 201 debug_fcp_ctype(data[0]),
157 debug_fcp_opcode(op, data, length)); 202 debug_fcp_opcode(op, data, length));
203 if (avc_debug & AVC_DEBUG_FCP_PAYLOADS)
204 print_hex_dump(KERN_INFO, prefix, DUMP_PREFIX_NONE,
205 16, 1, data, length, false);
158 } 206 }
207}
159 208
160 if (avc_debug & AVC_DEBUG_FCP_PAYLOADS) 209static void debug_pmt(char *msg, int length)
161 print_hex_dump(KERN_INFO, prefix, DUMP_PREFIX_NONE, 16, 1, 210{
162 data, length, false); 211 printk(KERN_INFO "APP PMT -> l=%d\n", length);
212 print_hex_dump(KERN_INFO, "APP PMT -> ", DUMP_PREFIX_NONE,
213 16, 1, msg, length, false);
163} 214}
164 215
165static int __avc_write(struct firedtv *fdtv, 216static int __avc_write(struct firedtv *fdtv,
@@ -983,6 +1034,9 @@ int avc_ca_pmt(struct firedtv *fdtv, char *msg, int length)
983 int es_info_length; 1034 int es_info_length;
984 int crc32_csum; 1035 int crc32_csum;
985 1036
1037 if (unlikely(avc_debug & AVC_DEBUG_APPLICATION_PMT))
1038 debug_pmt(msg, length);
1039
986 memset(c, 0, sizeof(*c)); 1040 memset(c, 0, sizeof(*c));
987 1041
988 c->ctype = AVC_CTYPE_CONTROL; 1042 c->ctype = AVC_CTYPE_CONTROL;