summaryrefslogtreecommitdiffstats
path: root/src/query.c
diff options
context:
space:
mode:
authorpancake <pancake@dazo>2008-12-08 18:13:36 +0100
committerpancake <pancake@dazo>2008-12-08 18:13:36 +0100
commit5a96158322b4b7e8289dfd429af3e7b15a99d173 (patch)
treed095a25f2bf1485132895c1525786fa34f71f5e8 /src/query.c
parent3d427bfd7740731bfc203b047d557af564975cf6 (diff)
download0xFFFF-5a96158322b4b7e8289dfd429af3e7b15a99d173.tar.bz2
* Implement and test direct file FIASCO flash - openfiasco receives options for grepping for pieces and be verbose - fixed flashing order using grep options xloader, secondary, kernel, initfs, rootfs - Tested and working - Added parser for the hw revision string
* Autodetect device hw revision and setup the subversion string on the fly.
Diffstat (limited to 'src/query.c')
-rw-r--r--src/query.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/query.c b/src/query.c
index 404a60b..e8a331c 100644
--- a/src/query.c
+++ b/src/query.c
@@ -134,27 +134,28 @@ int set_rd_mode(unsigned short mode)
/*
* query root device
*/
-int get_hw_revision()
+int get_hw_revision(char *str, int len)
{
unsigned char string[512];
- int i = 0;
+ char tmpstr[64];
+ int i = 0, j=0, mod=0;
+ if (str == NULL)
+ str = tmpstr;
memset(string,'\0',512);
if (usb_control_msg(dev, CMD_QUERY, NOLO_GET_HWVERSION, 0, 0, (char *)string, 512, 2000) == -1) {
fprintf(stderr, "Cannot query hw revision.\n");
return -1;
}
- printf("HW revision string: '");
- for(i=0;i<44;i++) { // XXX ??
- if (string[i]==0) {
- printf(" ");
- } else {
- if (string[i]>19)
- printf("%c", string[i]);
+ for(i=0;i<44&&i<len;i++) { // XXX ??
+ if (string[i]>19) {
+ if (i>0 && string[i-1]<19)
+ str[j++] = (++mod%2)?':':',';
+ str[j++] = string[i];
}
}
- printf("'\n");
+ printf("HW revision string: '%s'\n", str);
return 0;
}