From 9c59563d4c874e12177012615eb7a91cd02b58b6 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Thu, 31 May 2012 09:04:00 +0200 Subject: [PATCH] Add support for eeprom bank number 2. Devices with firmware version 2.22 (or greater) have an additional eeprom bank with new custom functions. --- src/hw_ostc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/hw_ostc.c b/src/hw_ostc.c index ff112b8..a0ff652 100644 --- a/src/hw_ostc.c +++ b/src/hw_ostc.c @@ -403,7 +403,7 @@ hw_ostc_device_eeprom_read (device_t *abstract, unsigned int bank, unsigned char if (! device_is_hw_ostc (abstract)) return DEVICE_STATUS_TYPE_MISMATCH; - if (bank > 1) { + if (bank > 2) { WARNING ("Invalid eeprom bank specified."); return DEVICE_STATUS_ERROR; } @@ -414,8 +414,8 @@ hw_ostc_device_eeprom_read (device_t *abstract, unsigned int bank, unsigned char } // Send the command. - unsigned char command = (bank == 0) ? 'g' : 'j'; - device_status_t rc = hw_ostc_send (device, command, 0); + const unsigned char command[] = {'g', 'j', 'm'}; + device_status_t rc = hw_ostc_send (device, command[bank], 0); if (rc != DEVICE_STATUS_SUCCESS) return rc; @@ -438,7 +438,7 @@ hw_ostc_device_eeprom_write (device_t *abstract, unsigned int bank, const unsign if (! device_is_hw_ostc (abstract)) return DEVICE_STATUS_TYPE_MISMATCH; - if (bank > 1) { + if (bank > 2) { WARNING ("Invalid eeprom bank specified."); return DEVICE_STATUS_ERROR; } @@ -449,8 +449,8 @@ hw_ostc_device_eeprom_write (device_t *abstract, unsigned int bank, const unsign } // Send the command. - unsigned char command = (bank == 0) ? 'd' : 'i'; - device_status_t rc = hw_ostc_send (device, command, 1); + const unsigned char command[] = {'d', 'i', 'n'}; + device_status_t rc = hw_ostc_send (device, command[bank], 1); if (rc != DEVICE_STATUS_SUCCESS) return rc;