chiark / gitweb /
faster, better chatting
authorian <ian>
Sun, 3 Oct 2004 16:42:24 +0000 (16:42 +0000)
committerian <ian>
Sun, 3 Oct 2004 16:42:24 +0000 (16:42 +0000)
parport/odyssey-train
parport/train-pic-prog-select.c

index 8f4fa696194c217c6cf725ed6f0ee4f0c301d6e3..077a8922b5a9e8ec0f24af07d514b93ad78193ae 100755 (executable)
@@ -14,10 +14,12 @@ case "$which" in
 all)
        train-pic-prog-select 0-55
        whichconfig=all
+       echo "Selected $which"
        ;;
 [0-9]|[0-9][0-9])
        train-pic-prog-select $which
        whichconfig=single
+       echo "Selected #$which"
        ;;
 *)
        badusage
@@ -25,7 +27,6 @@ all)
 esac
 
 shift
-echo "Selected $which"
 echo
 
 operation=$1
index fdde729efcfe7d1750c9c7f0757514c0a9ac504c..d1a8315f4b357b32399b66742ac6aa5581c765cc 100644 (file)
@@ -40,12 +40,12 @@ static void wpause(int ioctlnum, unsigned char value) {
         ioctlnum == PPWDATA ? "" : 0,
         value);
   doioctl(ioctlnum, &value, value);
-  usleep(5000);
+  usleep(1);
 }
 
 int main(int argc, const char *const *argv) {
   long first, last;
-  int row, col, v;
+  int row, col, v, nselected;
   char *ep;
   const char *arg;
   
@@ -83,6 +83,12 @@ int main(int argc, const char *const *argv) {
 
   setvbuf(stdout,0,_IONBF,0);
   
+  for (nselected=0, row=0; row<ROWS; row++)
+    for (col=0; col<COLUMNS; col++)
+      if (yesses.rect[col][row])
+       nselected++;
+  printf("Selecting %d/%d; bytes:", nselected, ROWS*COLUMNS);
+
   doioctl(PPCLAIM,0,0);
   wpause(PPWCONTROL, 0x02 /* !ENGAGE_VPP, !PC, !PDW */);