summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Isely <devnull@localhost>2006-01-09 06:37:48 +0000
committerMike Isely <devnull@localhost>2006-01-09 06:37:48 +0000
commit2d393c98a1b0a64bd87ca69735ac58de396cf86c (patch)
tree71f6105e47454ce9bbb934fed191531d1173d9a4
parent98dc39bded3ceccb2f85b17056ac8b586ff00a14 (diff)
downloadmediapointer-dvb-s2-2d393c98a1b0a64bd87ca69735ac58de396cf86c.tar.gz
mediapointer-dvb-s2-2d393c98a1b0a64bd87ca69735ac58de396cf86c.tar.bz2
Improve reporting and handling of pvrusb2 firmware load failures.
From: Mike Isely <isely@pobox.com> Signed-off-by: Mike Isely <isely@pobox.com>
-rw-r--r--v4l/ChangeLog13
-rw-r--r--v4l_experimental/pvrusb2/pvrusb2-hdw-internal.h10
-rw-r--r--v4l_experimental/pvrusb2/pvrusb2-hdw.c54
3 files changed, 69 insertions, 8 deletions
diff --git a/v4l/ChangeLog b/v4l/ChangeLog
index 5ecf6bef0..5907ae4ad 100644
--- a/v4l/ChangeLog
+++ b/v4l/ChangeLog
@@ -1,3 +1,16 @@
+2006-01-09 06:33 mcisely
+
+ * v4l_experimental/pvrusb2/pvrusb2-hdw-internal.h:
+ * v4l_experimental/pvrusb2/pvrusb2-hdw.c: (pvr2_upload_firmware1),
+ (pvr2_upload_firmware2), (pvr2_hdw_setup_low), (pvr2_hdw_setup):
+
+ - Improve reporting and handling of pvrusb2 firmware load failures
+ (we attempt to detect the common case of firmware files not
+ present and inform the user - a previous long standing source of
+ confusion).
+
+ Signed-off-by: Mike Isely <isely@pobox.com>
+
2006-01-09 06:22 mcisely
* v4l_experimental/pvrusb2/pvrusb2-debug.h:
diff --git a/v4l_experimental/pvrusb2/pvrusb2-hdw-internal.h b/v4l_experimental/pvrusb2/pvrusb2-hdw-internal.h
index bcdf143f6..4f2bb58ac 100644
--- a/v4l_experimental/pvrusb2/pvrusb2-hdw-internal.h
+++ b/v4l_experimental/pvrusb2/pvrusb2-hdw-internal.h
@@ -1,6 +1,6 @@
/*
*
- * $Id: pvrusb2-hdw-internal.h,v 1.4 2006/01/01 08:26:03 mcisely Exp $
+ * $Id: pvrusb2-hdw-internal.h,v 1.5 2006/01/09 06:37:48 mcisely Exp $
*
* Copyright (C) 2005 Mike Isely <isely@pobox.com>
*
@@ -81,6 +81,13 @@ struct pvr2_decoder_ctrl {
PVR2_I2C_PEND_REFRESH |\
PVR2_I2C_PEND_STALE)
+/* Disposition of firmware1 loading situation */
+#define FW1_STATE_UNKNOWN 0
+#define FW1_STATE_MISSING 1
+#define FW1_STATE_FAILED 2
+#define FW1_STATE_RELOAD 3
+#define FW1_STATE_OK 4
+
/* This structure contains all state data directly needed to
manipulate the hardware (as opposed to complying with a kernel
interface) */
@@ -136,6 +143,7 @@ struct pvr2_hdw {
int flag_disconnected; // flag_ok == 0 due to disconnect
int flag_init_ok; // true if structure is fully initialized
int flag_streaming_enabled; // true if streaming should be on
+ int fw1_state; // current situation with fw1
int flag_decoder_is_tuned;
diff --git a/v4l_experimental/pvrusb2/pvrusb2-hdw.c b/v4l_experimental/pvrusb2/pvrusb2-hdw.c
index 9bd6ae885..396c25c78 100644
--- a/v4l_experimental/pvrusb2/pvrusb2-hdw.c
+++ b/v4l_experimental/pvrusb2/pvrusb2-hdw.c
@@ -1,6 +1,6 @@
/*
*
- * $Id: pvrusb2-hdw.c,v 1.7 2006/01/03 05:51:57 mcisely Exp $
+ * $Id: pvrusb2-hdw.c,v 1.8 2006/01/09 06:37:48 mcisely Exp $
*
* Copyright (C) 2005 Mike Isely <isely@pobox.com>
*
@@ -440,6 +440,8 @@ int pvr2_upload_firmware1(struct pvr2_hdw *hdw)
u16 address;
const char *firmware_file = FIRMWARE1_FILE;
+ hdw->fw1_state = FW1_STATE_FAILED; // default result
+
trace_firmware("pvr2_upload_firmware1");
usb_settoggle(hdw->usb_dev, 0 & 0xf, !(0 & USB_DIR_IN), 0);
@@ -450,7 +452,11 @@ int pvr2_upload_firmware1(struct pvr2_hdw *hdw)
if (ret) {
pvr2_trace(PVR2_TRACE_ERROR_LEGS,
- "request_firmware failed for '%s'", firmware_file);
+ "request_firmware failed for '%s' code=%d",
+ firmware_file,ret);
+ if (ret == -ENOENT) {
+ hdw->fw1_state = FW1_STATE_MISSING;
+ }
return ret;
}
@@ -490,7 +496,12 @@ int pvr2_upload_firmware1(struct pvr2_hdw *hdw)
trace_firmware("Upload done (%d bytes sent)",ret);
/* We should have written 8192 bytes */
- return (ret == 8192) ? 0 : -EIO;
+ if (ret == 8192) {
+ hdw->fw1_state = FW1_STATE_RELOAD;
+ return 0;
+ }
+
+ return -EIO;
}
@@ -545,6 +556,15 @@ int pvr2_upload_firmware2(struct pvr2_hdw *hdw)
if (ret) {
pvr2_trace(PVR2_TRACE_ERROR_LEGS,
"request_firmware failed for '%s'", FIRMWARE2_FILE);
+ if (ret == -ENOENT) {
+ pvr2_trace(PVR2_TRACE_ERROR_LEGS,
+ "***WARNING***"
+ " Device encoder firmware"
+ " seems to be missing.");
+ pvr2_trace(PVR2_TRACE_ERROR_LEGS,
+ "Did you install the pvrusb2 firmware files"
+ " in their proper location?");
+ }
return ret;
}
@@ -931,6 +951,7 @@ static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw)
}
return;
}
+ hdw->fw1_state = FW1_STATE_OK;
if (initusbreset) {
pvr2_hdw_device_reset(hdw);
@@ -1010,13 +1031,31 @@ int pvr2_hdw_setup(struct pvr2_hdw *hdw)
PVR2_TRACE_INFO,
"Device initialization"
" completed successfully.");
- } else {
+ break;
+ }
+ if (hdw->fw1_state == FW1_STATE_RELOAD) {
pvr2_trace(
PVR2_TRACE_INFO,
- "Device firmware (re)load executed;"
- " it should now reset and reconnect.");
+ "Device microcontroller firmware"
+ " (re)loaded; it should now reset"
+ " and reconnect.");
+ break;
}
- break;
+ if (hdw->fw1_state == FW1_STATE_MISSING) {
+ pvr2_trace(
+ PVR2_TRACE_ERROR_LEGS,
+ "***WARNING***"
+ " Device microcontroller firmware"
+ " seems to be missing.");
+ pvr2_trace(
+ PVR2_TRACE_ERROR_LEGS,
+ "Did you install the pvrusb2 firmware"
+ " files in their proper location?");
+ break;
+ }
+ pvr2_trace(
+ PVR2_TRACE_ERROR_LEGS,
+ "Device initialization was not successful.");
}
if (procreload) {
pvr2_trace(
@@ -1027,6 +1066,7 @@ int pvr2_hdw_setup(struct pvr2_hdw *hdw)
PVR2_TRACE_ERROR_LEGS,
"If this works, device should disconnect"
" and reconnect in a sane state.");
+ hdw->fw1_state = FW1_STATE_UNKNOWN;
pvr2_upload_firmware1(hdw);
} else {
pvr2_trace(