Send commitlog mailing list submissions to
        commitlog@lists.openmoko.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
        [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:

   1. r4207 - trunk/src/target/opkg/libopkg ([EMAIL PROTECTED])
   2. r4208 - developers/werner/ahrt/host/tmc ([EMAIL PROTECTED])
   3. r4209 - trunk/src/target/opkg/libopkg ([EMAIL PROTECTED])
   4. r4210 - trunk/src/target/opkg/libopkg ([EMAIL PROTECTED])
   5. r4211 - developers/werner/ahrt/host/tmc ([EMAIL PROTECTED])
--- Begin Message ---
Author: thomas
Date: 2008-03-14 13:11:45 +0100 (Fri, 14 Mar 2008)
New Revision: 4207

Modified:
   trunk/src/target/opkg/libopkg/args.c
Log:
opkg: print help and version messages to stdout rather than stderr. Based on
patch from Marcin Juszkiewicz <openembedded haerwu biz>


Modified: trunk/src/target/opkg/libopkg/args.c
===================================================================
--- trunk/src/target/opkg/libopkg/args.c        2008-03-14 11:06:10 UTC (rev 
4206)
+++ trunk/src/target/opkg/libopkg/args.c        2008-03-14 12:11:45 UTC (rev 
4207)
@@ -232,81 +232,81 @@
 void args_usage(char *complaint)
 {
      if (complaint) {
-         fprintf(stderr, "opkg: %s\n", complaint);
+         printf("opkg: %s\n", complaint);
      }
      print_version();
-     fprintf(stderr, "usage: opkg [options...] sub-command [arguments...]\n");
-     fprintf(stderr, "where sub-command is one of:\n");
+     printf("usage: opkg [options...] sub-command [arguments...]\n");
+     printf("where sub-command is one of:\n");
     
-     fprintf(stderr, "\nPackage Manipulation:\n");
-     fprintf(stderr, "\tupdate                 Update list of available 
packages\n");
-     fprintf(stderr, "\tupgrade                        Upgrade all installed 
packages to latest version\n");
-     fprintf(stderr, "\tinstall <pkg>          Download and install <pkg> (and 
dependencies)\n");
-     fprintf(stderr, "\tinstall <file.ipk>     Install package <file.ipk>\n");
-     fprintf(stderr, "\tconfigure [<pkg>]      Configure unpacked packages\n");
-     fprintf(stderr, "\tremove <pkg|regexp>    Remove package <pkg|packages 
following regexp>\n");
-     fprintf(stderr, "\tflag <flag> <pkg> ...  Flag package(s) <pkg>\n");
-     fprintf(stderr, "\t <flag>=hold|noprune|user|ok|installed|unpacked (one 
per invocation)   \n");
+     printf("\nPackage Manipulation:\n");
+     printf("\tupdate                  Update list of available packages\n");
+     printf("\tupgrade                 Upgrade all installed packages to 
latest version\n");
+     printf("\tinstall <pkg>           Download and install <pkg> (and 
dependencies)\n");
+     printf("\tinstall <file.ipk>      Install package <file.ipk>\n");
+     printf("\tconfigure [<pkg>]       Configure unpacked packages\n");
+     printf("\tremove <pkg|regexp>     Remove package <pkg|packages following 
regexp>\n");
+     printf("\tflag <flag> <pkg> ...   Flag package(s) <pkg>\n");
+     printf("\t <flag>=hold|noprune|user|ok|installed|unpacked (one per 
invocation)    \n");
     
-     fprintf(stderr, "\nInformational Commands:\n");
-     fprintf(stderr, "\tlist                   List available packages and 
descriptions\n");
-     fprintf(stderr, "\tlist_installed         List all and only the installed 
packages and description \n");
-     fprintf(stderr, "\tfiles <pkg>            List all files belonging to 
<pkg>\n");
-     fprintf(stderr, "\tsearch <file|regexp>           Search for a package 
providing <file>\n");
-     fprintf(stderr, "\tinfo [pkg|regexp]              Display all info for 
<pkg>\n");
-     fprintf(stderr, "\tstatus [pkg|regexp]            Display all status for 
<pkg>\n");
-     fprintf(stderr, "\tdownload <pkg>         Download <pkg> to current 
directory.\n");
-     fprintf(stderr, "\tcompare_versions <v1> <op> <v2>\n");
-     fprintf(stderr, "\t                          compare versions using <= < 
> >= = << >>\n");
-     fprintf(stderr, "\tprint_architecture      prints the architecture.\n");
-     fprintf(stderr, "\tprint_installation_architecture\n");
-     fprintf(stderr, "\twhatdepends [-A] [pkgname|pat]+\n");
-     fprintf(stderr, "\twhatdependsrec [-A] [pkgname|pat]+\n");
-     fprintf(stderr, "\twhatprovides [-A] [pkgname|pat]+\n");
-     fprintf(stderr, "\twhatconflicts [-A] [pkgname|pat]+\n");
-     fprintf(stderr, "\twhatreplaces [-A] [pkgname|pat]+\n");
-     fprintf(stderr, "\t                        prints the installation 
architecture.\n");    
-     fprintf(stderr, "\nOptions:\n");
-     fprintf(stderr, "\t-A                      Query all packages with 
whatdepends, whatprovides, whatreplaces, whatconflicts\n"); 
-     fprintf(stderr, "\t-V <level>               Set verbosity level to 
<level>. If no value is\n");
-     fprintf(stderr, "\t--verbosity <level>      provided increase verbosity 
by one. Verbosity levels:\n");
-     fprintf(stderr, "\t                         0 errors only\n");
-     fprintf(stderr, "\t                         1 normal messages 
(default)\n");
-     fprintf(stderr, "\t                         2 informative messages\n");
-     fprintf(stderr, "\t                         3 debug output\n");
-     fprintf(stderr, "\t-f <conf_file>         Use <conf_file> as the opkg 
configuration file\n");
-     fprintf(stderr, "\t-conf <conf_file>      Default configuration file 
location\n");
-     fprintf(stderr, "                         is %s/%s\n", 
ARGS_DEFAULT_CONF_FILE_DIR, ARGS_DEFAULT_CONF_FILE_NAME);
-     fprintf(stderr, "\t-d <dest_name>         Use <dest_name> as the the root 
directory for\n");
-     fprintf(stderr, "\t-dest <dest_name>      package installation, removal, 
upgrading.\n");
-     fprintf(stderr, "                         <dest_name> should be a defined 
dest name from\n");
-     fprintf(stderr, "                         the configuration file, (but 
can also be a\n");
-     fprintf(stderr, "                         directory name in a pinch).\n");
-     fprintf(stderr, "\t-o <offline_root>      Use <offline_root> as the root 
directory for\n");
-     fprintf(stderr, "\t-offline <offline_root>        offline installation of 
packages.\n");
-     fprintf(stderr, "\t-verbose_wget          more wget messages\n");
+     printf("\nInformational Commands:\n");
+     printf("\tlist                    List available packages and 
descriptions\n");
+     printf("\tlist_installed          List all and only the installed 
packages and description \n");
+     printf("\tfiles <pkg>             List all files belonging to <pkg>\n");
+     printf("\tsearch <file|regexp>            Search for a package providing 
<file>\n");
+     printf("\tinfo [pkg|regexp]               Display all info for <pkg>\n");
+     printf("\tstatus [pkg|regexp]             Display all status for 
<pkg>\n");
+     printf("\tdownload <pkg>          Download <pkg> to current 
directory.\n");
+     printf("\tcompare_versions <v1> <op> <v2>\n");
+     printf("\t                          compare versions using <= < > >= = << 
>>\n");
+     printf("\tprint_architecture      prints the architecture.\n");
+     printf("\tprint_installation_architecture\n");
+     printf("\twhatdepends [-A] [pkgname|pat]+\n");
+     printf("\twhatdependsrec [-A] [pkgname|pat]+\n");
+     printf("\twhatprovides [-A] [pkgname|pat]+\n");
+     printf("\twhatconflicts [-A] [pkgname|pat]+\n");
+     printf("\twhatreplaces [-A] [pkgname|pat]+\n");
+     printf("\t                        prints the installation 
architecture.\n");    
+     printf("\nOptions:\n");
+     printf("\t-A                      Query all packages with whatdepends, 
whatprovides, whatreplaces, whatconflicts\n"); 
+     printf("\t-V <level>               Set verbosity level to <level>. If no 
value is\n");
+     printf("\t--verbosity <level>      provided increase verbosity by one. 
Verbosity levels:\n");
+     printf("\t                         0 errors only\n");
+     printf("\t                         1 normal messages (default)\n");
+     printf("\t                         2 informative messages\n");
+     printf("\t                         3 debug output\n");
+     printf("\t-f <conf_file>          Use <conf_file> as the opkg 
configuration file\n");
+     printf("\t-conf <conf_file>       Default configuration file location\n");
+     printf("                          is %s/%s\n", 
ARGS_DEFAULT_CONF_FILE_DIR, ARGS_DEFAULT_CONF_FILE_NAME);
+     printf("\t-d <dest_name>          Use <dest_name> as the the root 
directory for\n");
+     printf("\t-dest <dest_name>       package installation, removal, 
upgrading.\n");
+     printf("                          <dest_name> should be a defined dest 
name from\n");
+     printf("                          the configuration file, (but can also 
be a\n");
+     printf("                          directory name in a pinch).\n");
+     printf("\t-o <offline_root>       Use <offline_root> as the root 
directory for\n");
+     printf("\t-offline <offline_root> offline installation of packages.\n");
+     printf("\t-verbose_wget           more wget messages\n");
     
-     fprintf(stderr, "\tForce Options (use when opkg is too smart for its own 
good):\n");
-     fprintf(stderr, "\t-force-depends         Make dependency checks warnings 
instead of errors\n");
-     fprintf(stderr, "\t                               Install/remove package 
in spite of failed dependences\n");
-     fprintf(stderr, "\t-force-defaults                Use default options for 
questions asked by opkg.\n");
-     fprintf(stderr, "                         (no prompts). Note that this 
will not prevent\n");
-     fprintf(stderr, "                         package installation scripts 
from prompting.\n");
-     fprintf(stderr, "\t-force-reinstall       Allow opkg to reinstall a 
package.\n");
-     fprintf(stderr, "\t-force-overwrite       Allow opkg to overwrite files 
from another package during an install.\n");
-     fprintf(stderr, "\t-force-downgrade       Allow opkg to downgrade 
packages.\n");
-     fprintf(stderr, "\t-force_space            Install even if there does not 
seem to be enough space.\n");
-     fprintf(stderr, "\t-noaction               No action -- test only\n");
-     fprintf(stderr, "\t-nodeps                 Do not follow dependences\n");
-     fprintf(stderr, "\t-force-removal-of-dependent-packages\n");
-     fprintf(stderr, "\t-recursive             Allow opkg to remove package 
and all that depend on it.\n");
-     fprintf(stderr, "\t-autoremove            Allow opkg to remove packages 
that where installed automatically to satisfy dependencies.\n");
-     fprintf(stderr, "\t-test                   No action -- test only\n");
-     fprintf(stderr, "\t-t                     Specify tmp-dir.\n");
-     fprintf(stderr, "\t--tmp-dir              Specify tmp-dir.\n");
-     fprintf(stderr, "\n");
-     fprintf(stderr, "\tregexp could be something like 'pkgname*' '*file*' or 
similar\n");
-     fprintf(stderr, "\teg: opkg info 'libstd*'  or opkg search '*libop*' or 
opkg remove 'libncur*'\n");
+     printf("\tForce Options (use when opkg is too smart for its own 
good):\n");
+     printf("\t-force-depends          Make dependency checks warnings instead 
of errors\n");
+     printf("\t                                Install/remove package in spite 
of failed dependences\n");
+     printf("\t-force-defaults         Use default options for questions asked 
by opkg.\n");
+     printf("                          (no prompts). Note that this will not 
prevent\n");
+     printf("                          package installation scripts from 
prompting.\n");
+     printf("\t-force-reinstall        Allow opkg to reinstall a package.\n");
+     printf("\t-force-overwrite        Allow opkg to overwrite files from 
another package during an install.\n");
+     printf("\t-force-downgrade        Allow opkg to downgrade packages.\n");
+     printf("\t-force_space            Install even if there does not seem to 
be enough space.\n");
+     printf("\t-noaction               No action -- test only\n");
+     printf("\t-nodeps                 Do not follow dependences\n");
+     printf("\t-force-removal-of-dependent-packages\n");
+     printf("\t-recursive              Allow opkg to remove package and all 
that depend on it.\n");
+     printf("\t-autoremove             Allow opkg to remove packages that 
where installed automatically to satisfy dependencies.\n");
+     printf("\t-test                   No action -- test only\n");
+     printf("\t-t                      Specify tmp-dir.\n");
+     printf("\t--tmp-dir               Specify tmp-dir.\n");
+     printf("\n");
+     printf("\tregexp could be something like 'pkgname*' '*file*' or 
similar\n");
+     printf("\teg: opkg info 'libstd*'  or opkg search '*libop*' or opkg 
remove 'libncur*'\n");
      /* -force-removal-of-essential-packages   Let opkg remove essential 
packages. 
        Using this option is almost guaranteed to break your system, hence this 
option
        is not even advertised in the usage statement. */
@@ -315,5 +315,5 @@
 
 static void print_version(void)
 {
-     fprintf(stderr, "opkg version %s\n", VERSION);
+     printf("opkg version %s\n", VERSION);
 }




--- End Message ---
--- Begin Message ---
Author: werner
Date: 2008-03-14 15:22:08 +0100 (Fri, 14 Mar 2008)
New Revision: 4208

Modified:
   developers/werner/ahrt/host/tmc/io.c
   developers/werner/ahrt/host/tmc/io.h
   developers/werner/ahrt/host/tmc/tmc.c
   developers/werner/ahrt/host/tmc/usbtmc.c
Log:
- tmc.c (tmc_open): send DCI after opening a session
- tmc.c (tmc_read): handle read errors
- io.c (read_buf): don't leak buffer memory
- io.h, io.c (io_cancel_buf): new function to deallocate a buffer without
  reading it
- usbtmc.c (struct usbtmc_dsc, get_eps): record maximum packet size (for use by
  usbtmc_dci)
- usbtmc.c (usbtmc_clear): implement the INITATE_CLEAR procedure
- usbtmc.c (usbtmc_abort_out): implement part of the ABORT_BULK_OUT procedure
- usbtmc.c (usbtmc_dci): attempt to cancel any ongoing transfer
- usbtmc.c (debug), io.h (debug), io.c (debug): moved local "debug" from
  usbtmc.c to io.c and made it global



Modified: developers/werner/ahrt/host/tmc/io.c
===================================================================
--- developers/werner/ahrt/host/tmc/io.c        2008-03-14 12:11:45 UTC (rev 
4207)
+++ developers/werner/ahrt/host/tmc/io.c        2008-03-14 14:22:08 UTC (rev 
4208)
@@ -23,7 +23,9 @@
 #include "io.h"
 
 
+int debug = 1;
 
+
 /* ----- Asynchronous I/O -------------------------------------------------- */
 
 
@@ -195,6 +197,16 @@
        }
        memcpy(buf, d->buf, len);
 //fprintf(stderr, "(%.*s) %d\n", len, d->buf, len);
+       free(d->buf);
        free(d);
        return len;
 }
+
+
+void io_cancel_buf(void *dsc)
+{
+       struct io_sync_buf *d = dsc;
+
+       free(d->buf);
+       free(d);
+}

Modified: developers/werner/ahrt/host/tmc/io.h
===================================================================
--- developers/werner/ahrt/host/tmc/io.h        2008-03-14 12:11:45 UTC (rev 
4207)
+++ developers/werner/ahrt/host/tmc/io.h        2008-03-14 14:22:08 UTC (rev 
4208)
@@ -30,6 +30,7 @@
 void io_push_buf(void *dsc, const struct timeval *tv, const void *buf,
     size_t len, int end);
 size_t io_read_buf(void *dsc, void *buf, size_t size);
+void io_cancel_buf(void *dsc);
 
 
 struct proto_ops {
@@ -41,6 +42,8 @@
 };
 
 
+extern int debug;
+
 extern struct proto_ops telnet_ops; /* TELNET-like */
 extern struct proto_ops usbtmc_ops; /* USBTMC */
 extern struct proto_ops tty_ops; /* TTY */

Modified: developers/werner/ahrt/host/tmc/tmc.c
===================================================================
--- developers/werner/ahrt/host/tmc/tmc.c       2008-03-14 12:11:45 UTC (rev 
4207)
+++ developers/werner/ahrt/host/tmc/tmc.c       2008-03-14 14:22:08 UTC (rev 
4208)
@@ -43,8 +43,11 @@
        dsc->ops = ops;
        dsc->proto_dsc = ops->open(argc, argv);
        dsc->running = 0;
-       if (dsc->proto_dsc)
-               return dsc;
+       if (dsc->proto_dsc) {
+               if (!ops->dci(dsc->proto_dsc))
+                       return dsc;
+               ops->close(dsc->proto_dsc);
+       }
        free(dsc);
        return NULL;
 }
@@ -79,8 +82,10 @@
                return -1;
        }
        io_dsc = io_create_buf();
-       /* @@@FIXME: handle read error */
-       dsc->ops->read(dsc->proto_dsc, io_push_buf, io_dsc);
+       if (dsc->ops->read(dsc->proto_dsc, io_push_buf, io_dsc) < 0) {
+               io_cancel_buf(io_dsc);
+               return -1;
+       }
        return io_read_buf(io_dsc, buf, size);
 }
 

Modified: developers/werner/ahrt/host/tmc/usbtmc.c
===================================================================
--- developers/werner/ahrt/host/tmc/usbtmc.c    2008-03-14 12:11:45 UTC (rev 
4207)
+++ developers/werner/ahrt/host/tmc/usbtmc.c    2008-03-14 14:22:08 UTC (rev 
4208)
@@ -43,15 +43,27 @@
 #endif
 
 #define SIZE_IOBUFFER 4096
-#define DEV_DEP_MSG_OUT        1
-#define DEV_DEP_MSG_IN 2
-#define INITIATE_ABORT_BULK_IN 3
 
+#define DEV_DEP_MSG_OUT                        1
+#define DEV_DEP_MSG_IN                 2
 
+#define INITIATE_ABORT_BULK_OUT                1
+#define CHECK_ABORT_BULK_OUT_STATUS    2
+#define INITIATE_ABORT_BULK_IN         3
+#define CHECK_ABORT_BULK_STATUS                4
+#define INITIATE_CLEAR                 5
+#define CHECK_CLEAR_STATUS             6
+
+#define STATUS_SUCCESS                 0x01
+#define STATUS_PENDING                 0x02
+#define STATUS_FAILED                  0x80
+
+
 struct usbtmc_dsc {
        usb_dev_handle *handle;         /* USB device handle */
        uint8_t ep_int_in, ep_bulk_in, ep_bulk_out; /* endpoints */
        uint8_t bTag;                   /* sequence number */
+       uint16_t max_packet;            /* maximum ep_bulk_in packet size */
        unsigned long timeout;          /* timeout in milliseconds */
        int retry;                      /* retry after timeouts */
        void *last_buf;                 /* last buffer sent */
@@ -59,9 +71,6 @@
 };
 
 
-static int debug = 0;
-
-
 /* ----- Debugging --------------------------------------------------------- */
 
 
@@ -123,6 +132,7 @@
                                return -1;
                        }
                        d->ep_bulk_in = ep->bEndpointAddress;
+                       d->max_packet = ep->wMaxPacketSize;
                        break;
                case USB_ENDPOINT_TYPE_BULK:
                        if (d->ep_bulk_out) {
@@ -268,6 +278,8 @@
        uint8_t buf[2];
        ssize_t got;
 
+       if (debug)
+               fprintf(stderr, "INITIATE_ABORT_BULK_IN\n");
        got = usb_control_msg(d->handle,
            USB_ENDPOINT_IN | USB_TYPE_CLASS | USB_RECIP_ENDPOINT,
            INITIATE_ABORT_BULK_IN,
@@ -285,6 +297,106 @@
 }
 
 
+static void usbtmc_abort_out(struct usbtmc_dsc *d)
+{
+       uint8_t buf[2];
+       ssize_t got;
+
+       if (debug)
+               fprintf(stderr, "INITIATE_ABORT_BULK_OUT\n");
+       got = usb_control_msg(d->handle,
+           USB_ENDPOINT_IN | USB_TYPE_CLASS | USB_RECIP_ENDPOINT,
+           INITIATE_ABORT_BULK_OUT,
+           d->bTag,
+           d->ep_bulk_out,
+           (void *) buf, 2, d->timeout);
+       if (got < 0) {
+               fprintf(stderr, "INITIATE_ABORT_BULK_OUT error %d\n",
+                   (int) got);
+               return;
+       }
+       fprintf(stderr, "status 0x%02x bTag 0x%02x\n", buf[0], buf[1]);
+
+       /* depending on status, do more */
+}
+
+
+static int usbtmc_clear(struct usbtmc_dsc *d)
+{
+       uint8_t buf[SIZE_IOBUFFER];
+       ssize_t got;
+       int error;
+
+       if (debug)
+               fprintf(stderr, "INITIATE_CLEAR\n");
+       got = usb_control_msg(d->handle,
+           USB_ENDPOINT_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
+           INITIATE_CLEAR,
+           0,
+           0, /* interface number */
+           (void *) buf, 1, d->timeout);
+       if (got < 0) {
+               fprintf(stderr, "INITIATE_CLEAR error %d\n", (int) got);
+               return -1;
+       }
+
+       if (debug)
+               fprintf(stderr, "INITIATE_CLEAR status 0x%02x\n", buf[0]);
+       if (buf[0] != STATUS_SUCCESS)
+               return 0;
+
+       while (1) {
+               if (debug)
+                       fprintf(stderr, "CHECK_CLEAR_STATUS\n");
+               got = usb_control_msg(d->handle,
+                   USB_ENDPOINT_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
+                   CHECK_CLEAR_STATUS,
+                   0,
+                   0, /* interface number */
+                   (void *) buf, 2, d->timeout);
+               if (got < 0) {
+                       fprintf(stderr, "CHECK_CLEAR_STATUS error %d\n",
+                           (int) got);
+                       return -1;
+               }
+
+               if (debug)
+                       fprintf(stderr,
+                           "CHECK_CLEAR_STATUS status 0x%02x, 0x%02x\n",
+                           buf[0], buf[1]);
+               if (buf[0] != STATUS_PENDING)
+                       break;
+
+               if (!(buf[1] & 1))
+                       continue;
+
+               if (debug)
+                       fprintf(stderr, "%d vs %d\n",
+                           SIZE_IOBUFFER, d->max_packet);
+               do {
+                       got = usb_bulk_read(d->handle, d->ep_bulk_in,
+                           (void *) buf, SIZE_IOBUFFER, d->timeout);
+                       if (got < 0) {
+                               fprintf(stderr, "read error %d\n", (int) got);
+                               return -1;
+                       }
+                       dump("RECV: discarding", buf, got);
+               }
+               while (got != d->max_packet);
+       }
+
+       if (debug)
+               fprintf(stderr, "usb_clear_halt\n");
+       error = usb_clear_halt(d->handle, d->ep_bulk_out);
+       if (error) {
+               fprintf(stderr, "usb_clear_halt error %d\n", error);
+               return -1;
+       }
+
+       return 0;
+}
+
+
 static void usage(void)
 {
        fprintf(stderr,
@@ -541,7 +653,18 @@
 
 static int usbtmc_dci(void *dsc)
 {
-       /* @@@FIXME: implement later */
+       struct usbtmc_dsc *d = dsc;
+
+       /*
+        * @@@FIXME: This doesn't seem work yet. The goal is to abort an
+        * on-going transfer, e.g., from a READ? with many samples. It succeeds
+        * to interrupt the transfer sometimes, but not all the time.
+        */
+       if (debug)
+               fprintf(stderr, "DCI\n");
+       //usbtmc_clear(d);
+       usbtmc_abort_in(d);
+       //usbtmc_abort_out(d);
        return 0;
 }
 




--- End Message ---
--- Begin Message ---
Author: thomas
Date: 2008-03-14 16:10:46 +0100 (Fri, 14 Mar 2008)
New Revision: 4209

Modified:
   trunk/src/target/opkg/libopkg/opkg_cmd.c
Log:
opkg: skip downloading Packages.sig if GPGME is not enabled at build time


Modified: trunk/src/target/opkg/libopkg/opkg_cmd.c
===================================================================
--- trunk/src/target/opkg/libopkg/opkg_cmd.c    2008-03-14 14:22:08 UTC (rev 
4208)
+++ trunk/src/target/opkg/libopkg/opkg_cmd.c    2008-03-14 15:10:46 UTC (rev 
4209)
@@ -257,6 +257,7 @@
          }
          free(url);
 
+#ifdef HAVE_GPGME
          /* download detached signitures to verify the package lists */
          /* get the url for the sig file */
          if (src->extra_data)  /* debian style? */
@@ -284,8 +285,11 @@
          }
          unlink (tmp_file_name);
          free (tmp_file_name);
-
          free (url);
+#else
+         opkg_message (conf, OPKG_NOTICE, "Signiture check for %s skipped "
+              "because GPG support was not enabled in this build\n", 
src->name);
+#endif
          free(list_file_name);
      }
      rmdir (tmp);




--- End Message ---
--- Begin Message ---
Author: thomas
Date: 2008-03-14 16:54:29 +0100 (Fri, 14 Mar 2008)
New Revision: 4210

Modified:
   trunk/src/target/opkg/libopkg/opkg_cmd.c
   trunk/src/target/opkg/libopkg/opkg_download.c
   trunk/src/target/opkg/libopkg/opkg_download.h
Log:
opkg: use opkg_message rather than printf in opkg_verify_file()


Modified: trunk/src/target/opkg/libopkg/opkg_cmd.c
===================================================================
--- trunk/src/target/opkg/libopkg/opkg_cmd.c    2008-03-14 15:10:46 UTC (rev 
4209)
+++ trunk/src/target/opkg/libopkg/opkg_cmd.c    2008-03-14 15:54:29 UTC (rev 
4210)
@@ -277,7 +277,7 @@
                opkg_message (conf, OPKG_NOTICE, "Signature check failed\n");
          } else {
            int err;
-           err = opkg_verify_file (list_file_name, tmp_file_name);
+           err = opkg_verify_file (conf, list_file_name, tmp_file_name);
            if (err == 0)
                opkg_message (conf, OPKG_NOTICE, "Signature check passed\n");
            else

Modified: trunk/src/target/opkg/libopkg/opkg_download.c
===================================================================
--- trunk/src/target/opkg/libopkg/opkg_download.c       2008-03-14 15:10:46 UTC 
(rev 4209)
+++ trunk/src/target/opkg/libopkg/opkg_download.c       2008-03-14 15:54:29 UTC 
(rev 4210)
@@ -293,7 +293,7 @@
 }
 
 int
-opkg_verify_file (char *text_file, char *sig_file)
+opkg_verify_file (opkg_conf_t *conf, char *text_file, char *sig_file)
 {
 #ifdef HAVE_GPGME
     int status = -1;
@@ -336,7 +336,7 @@
 
     return status;
 #else
-    printf ("Signature check skipped because GPG support was not enabled in 
this build\n");
+    opkg_message (conf, OPKG_NOTICE, "Signature check for %s was skipped 
because GPG support was not enabled in this build\n");
     return 0;
 #endif
 }

Modified: trunk/src/target/opkg/libopkg/opkg_download.h
===================================================================
--- trunk/src/target/opkg/libopkg/opkg_download.h       2008-03-14 15:10:46 UTC 
(rev 4209)
+++ trunk/src/target/opkg/libopkg/opkg_download.h       2008-03-14 15:54:29 UTC 
(rev 4210)
@@ -27,5 +27,5 @@
  */
 int opkg_prepare_url_for_install(opkg_conf_t *conf, const char *url, char 
**namep);
 
-int opkg_verify_file (char *text_file, char *sig_file);
+int opkg_verify_file (opkg_conf_t *conf, char *text_file, char *sig_file);
 #endif




--- End Message ---
--- Begin Message ---
Author: werner
Date: 2008-03-15 04:22:57 +0100 (Sat, 15 Mar 2008)
New Revision: 4211

Modified:
   developers/werner/ahrt/host/tmc/python.c
   developers/werner/ahrt/host/tmc/tmc.c
   developers/werner/ahrt/host/tmc/tmc.h
Log:
- tmc.c (tmc_stop): close the asynchronous file handler
- tmc.c (struct tmc_dsc, tmc_start, tmc_stop, launch), tmc.h (tmc_start),
  python.c (tmc_py_start): added optional second argument with a command to 
  send to restart asynchronous read



Modified: developers/werner/ahrt/host/tmc/python.c
===================================================================
--- developers/werner/ahrt/host/tmc/python.c    2008-03-14 15:54:29 UTC (rev 
4210)
+++ developers/werner/ahrt/host/tmc/python.c    2008-03-15 03:22:57 UTC (rev 
4211)
@@ -27,6 +27,9 @@
 };
 
 
+/*
+ * @@@FIXME: how to _properly_ deallocate these strings ?
+ */
 
 static char **make_argv(int skip, PyObject *args, int *argc)
 {
@@ -154,18 +157,32 @@
 }
 
 
-static PyObject *tmc_py_start(PyObject *self, PyObject *arg)
+static PyObject *tmc_py_start(PyObject *self, PyObject *args)
 {
        struct py_instr *s = (struct py_instr *) self;
+       char **argv;
+       int argc;
 
        if (!s->instr) {
                ERROR;
                return NULL;
        }
-       if (tmc_start(s->instr, PyString_AsString(arg))) {
+       argv = make_argv(0, args, &argc);
+       if (!argv) {
                ERROR;
                return NULL;
        }
+       if (argc < 1 || argc > 2) {
+               ERROR;
+               fprintf(stderr, "usage: filename [, command]\n");
+               free(argv);
+               return NULL;
+       }
+       if (tmc_start(s->instr, argv[0], argc == 2 ? argv[1] : NULL)) {
+               ERROR;
+               return NULL;
+       }
+       free(argv);
        return Py_BuildValue("");
 }
 

Modified: developers/werner/ahrt/host/tmc/tmc.c
===================================================================
--- developers/werner/ahrt/host/tmc/tmc.c       2008-03-14 15:54:29 UTC (rev 
4210)
+++ developers/werner/ahrt/host/tmc/tmc.c       2008-03-15 03:22:57 UTC (rev 
4211)
@@ -25,8 +25,9 @@
        const struct proto_ops *ops;    /* protocol operations */
        void *proto_dsc;                /* protocol descriptor */
        void *io_dsc;                   /* I/O descriptor */
-       int running;
-       pthread_t thread;
+       int running;                    /* asynchronous streaming is running */
+       pthread_t thread;               /* streaming thread */
+       char *repeat;                   /* command to send to repeat async. */
 };
 
 
@@ -94,12 +95,21 @@
 {
        struct tmc_dsc *dsc = arg;
 
-       dsc->ops->read(dsc->proto_dsc, io_push_async, dsc->io_dsc);
+       while (1) {
+               if (dsc->ops->read(dsc->proto_dsc, io_push_async, dsc->io_dsc)
+                   < 0)
+                       return NULL;
+               if (!dsc->repeat)
+                       return NULL;
+               if (dsc->ops->write(dsc->proto_dsc, dsc->repeat,
+                   strlen(dsc->repeat)))
+                       return NULL;
+       }
        return NULL;
 }
 
 
-int tmc_start(struct tmc_dsc *dsc, const char *file)
+int tmc_start(struct tmc_dsc *dsc, const char *file, const char *repeat)
 {
        if (dsc->running) {
                fprintf(stderr, "tmc_start: already running\n");
@@ -108,6 +118,15 @@
        dsc->io_dsc = io_setup_async(file);
        if (!dsc->io_dsc)
                return -1;
+       if (!repeat)
+               dsc->repeat = NULL;
+       else {
+               dsc->repeat = strdup(repeat);
+               if (!dsc->repeat) {
+                       io_end_async(dsc->io_dsc);
+                       return -1;
+               }
+       }
        dsc->running = 1;
        pthread_create(&dsc->thread, NULL, launch, dsc);
        return 0;
@@ -127,6 +146,8 @@
                fprintf(stderr, "pthread_cancel: %s\n", strerror(err));
        }
        dsc->running = 0;
+       io_end_async(dsc->io_dsc);
+       free(dsc->repeat);
        dsc->ops->dci(dsc->proto_dsc);
        return 0;
 }

Modified: developers/werner/ahrt/host/tmc/tmc.h
===================================================================
--- developers/werner/ahrt/host/tmc/tmc.h       2008-03-14 15:54:29 UTC (rev 
4210)
+++ developers/werner/ahrt/host/tmc/tmc.h       2008-03-15 03:22:57 UTC (rev 
4211)
@@ -26,7 +26,7 @@
 int tmc_close(struct tmc_dsc *dsc);
 int tmc_send(struct tmc_dsc *dsc, int argc, const char **argv);
 int tmc_read(struct tmc_dsc *dsc, void *buf, ssize_t size);
-int tmc_start(struct tmc_dsc *dsc, const char *file);
+int tmc_start(struct tmc_dsc *dsc, const char *file, const char *repeat);
 int tmc_stop(struct tmc_dsc *dsc);
 
 /*




--- End Message ---
_______________________________________________
commitlog mailing list
commitlog@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/commitlog

Reply via email to