Skip to content

Commit

Permalink
Improved calibration data detection.
Browse files Browse the repository at this point in the history
  • Loading branch information
Noltari committed Jan 18, 2013
1 parent 58f3370 commit f6c8199
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ath9k_caldata.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,8 @@ int main(int argc, char** argv) {
int ath9k_caldata_offset(uint8_t* caldata, int length, int* offset) {
int i, found = 0;

uint8_t caldata_magic[4] = {0xa5, 0x5a, 0, 0};
for(i = 0; i < length && (length - i) >= 4; i++) {
if(!memcmp(&caldata[i], &caldata_magic, 4)) {
for(i = 0; i < length && (length - i) >= ATH9K_CALDATA_SIZE; i++) {
if(!memcmp(&caldata[i], &caldata_magic, ATH9K_CALDATA_SIZE)) {
found = 1;
*offset = i;
break;
Expand Down
3 changes: 3 additions & 0 deletions ath9k_caldata.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
#define ATH9K_EEPROM_SIZE 2048
#define ATH9K_EEPROM_MAGIC 0xA55A

#define ATH9K_CALDATA_SIZE 6
uint8_t caldata_magic[ATH9K_CALDATA_SIZE] = {0xa5, 0x5a, 0, 0, 0, 0x03};

#define ATH9K_MAGC_OFF 0
#define ATH9K_CLEN_OFF (0x200 >> 1)
#define ATH9K_CSUM_OFF (0x202 >> 1)
Expand Down

0 comments on commit f6c8199

Please sign in to comment.