Update of /cvsroot/tinyos/tinyos-1.x/contrib/harvard/spaulding/src/gui/sessions/readSD
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv12126/src/gui/sessions/readSD
Modified Files:
downloadSessions.pl readSD.c
Log Message:
Added nodeID on flash
Index: downloadSessions.pl
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/harvard/spaulding/src/gui/sessions/readSD/downloadSessions.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** downloadSessions.pl 21 Dec 2007 02:24:41 -0000 1.2
--- downloadSessions.pl 21 Dec 2007 04:40:02 -0000 1.3
***************
*** 7,20 ****
my $SD_DEVICE_PATH = "/dev/sdd"; # Konrad's device
- my $node = @ARGV[0];
- if ($node eq "") {
- my $progName = basename($0);
- print "Usage: $progName <nodeID>\n\n";
- print " Example: ./$progName 10 \n";
- print " Example: ./$progName 11\n";
- exit(1);
- }
-
-
# (1) - Read in all files in current directory
opendir(DIR, '.') || die "Cannot open . for reading\n";
--- 7,10 ----
***************
*** 24,27 ****
foreach my $currDir (@subDirs) {
#print "Processing $currDir ...\n";
! system("./readSD.exe $currDir sessionInfo.txt $node $SD_DEVICE_PATH");
}
--- 14,17 ----
foreach my $currDir (@subDirs) {
#print "Processing $currDir ...\n";
! system("./readSD.exe $currDir sessionInfo.txt $SD_DEVICE_PATH");
}
Index: readSD.c
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/harvard/spaulding/src/gui/sessions/readSD/readSD.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** readSD.c 21 Dec 2007 02:24:41 -0000 1.2
--- readSD.c 21 Dec 2007 04:40:02 -0000 1.3
***************
*** 19,22 ****
--- 19,23 ----
{
uint32_t hash;
+ uint16_t nodeID;
uint32_t tail;
uint32_t head;
***************
*** 62,65 ****
--- 63,76 ----
}
+ uint16_t getNodeID(char *devicePath)
+ {
+ FlashInfo flashInfo;
+ FILE *sdFilePtr = fopen(devicePath, "rb");
+ getFlashInfo(&flashInfo, sdFilePtr);
+ fclose(sdFilePtr);
+ return flashInfo.nodeID;
+ }
+
+
void printFlashInfo(char *devicePath)
{
***************
*** 68,72 ****
getFlashInfo(&flashInfo, sdFilePtr);
! printf("hash= %u, tail= %u, head= %u\n", flashInfo.hash, flashInfo.tail, flashInfo.head);
fclose(sdFilePtr);
}
--- 79,85 ----
getFlashInfo(&flashInfo, sdFilePtr);
! printf("hash= %u, nodeID= %u, tail= %u, head= %u\n", flashInfo.hash, flashInfo.nodeID, flashInfo.tail, flashInfo.head);
! printf("tail= %u\n", flashInfo.tail);
! printf("head= %u\n", flashInfo.head);
fclose(sdFilePtr);
}
***************
*** 129,134 ****
char *sessionDir = argv[1];
char *sessionInfoFile = argv[2];
! uint16_t nodeID = strtoul(argv[3], NULL, 0);
! char *devicePath = argv[4];
uint32_t startBlockID;
uint32_t nbrBlocks;
--- 142,147 ----
char *sessionDir = argv[1];
char *sessionInfoFile = argv[2];
! char *devicePath = argv[3];
! uint16_t nodeID = getNodeID(devicePath);
uint32_t startBlockID;
uint32_t nbrBlocks;
***************
*** 139,143 ****
// (1) Print the FlashInfo
! //printFlashInfo(devicePath);
//return 0;
--- 152,156 ----
// (1) Print the FlashInfo
! printFlashInfo(devicePath);
//return 0;