Commit 9298a1898daecfef8749c64e667568e62e5b6330

Con Kolivas 2013-11-30T11:02:03

Perform basic displaying of hfa notices received.

diff --git a/driver-hashfast.c b/driver-hashfast.c
index 7d3ba10..6c63e4a 100644
--- a/driver-hashfast.c
+++ b/driver-hashfast.c
@@ -686,8 +686,21 @@ static void hfa_update_stats1(struct cgpu_info *hashfast, struct hashfast_info *
 #endif
 	applog(LOG_DEBUG, "      max_tx_buffers:               %6d", sd->max_tx_buffers);
 	applog(LOG_DEBUG, "      max_rx_buffers:               %6d", sd->max_rx_buffers);
+}
+
+static void hfa_parse_notice(struct cgpu_info *hashfast, struct hf_header *h)
+{
+	struct hf_usb_notice_data *d;
 
-    }
+	if (h->data_length == 0) {
+		applog(LOG_DEBUG, "HFA %d: Received OP_USB_NOTICE with zero data length",
+		       hashfast->device_id);
+		return;
+	}
+	d = (struct hf_usb_notice_data *)(h + 1);
+	/* FIXME Do something with the notification code d->extra_data here */
+	applog(LOG_NOTICE, "HFA %d NOTICE: %s", hashfast->device_id, d->message);
+}
 
 static void *hfa_read(void *arg)
 {
@@ -723,6 +736,9 @@ static void *hfa_read(void *arg)
 			case OP_USB_STATS1:
 				hfa_update_stats1(hashfast, info, h);
 				break;
+			case OP_USB_NOTICE:
+				hfa_parse_notice(hashfast, h);
+				break;
 			default:
 				applog(LOG_WARNING, "HFA %d: Unhandled operation code %d",
 				       hashfast->device_id, h->operation_code);