summaryrefslogtreecommitdiff
path: root/v4l_experimental/pvrusb2/pvrusb2-hdw.c
diff options
context:
space:
mode:
Diffstat (limited to 'v4l_experimental/pvrusb2/pvrusb2-hdw.c')
-rw-r--r--v4l_experimental/pvrusb2/pvrusb2-hdw.c54
1 files changed, 47 insertions, 7 deletions
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(