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. development kernel tree: Changes to 'stable' ([EMAIL PROTECTED]) 2. development kernel tree: Changes to 'andy' ([EMAIL PROTECTED]) 3. development kernel tree: Changes to 'debug' ([EMAIL PROTECTED]) 4. r4526 - developers/werner/ahrt/host/tmc ([EMAIL PROTECTED])
--- Begin Message ---include/linux/sdio/ctsystem_linux.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) New commits: commit 287b292cf95edbd82dc63085ae5f0167a6e8141f Author: Jason Uhlenkott <[EMAIL PROTECTED]> Date: Tue Jul 15 11:37:45 2008 +0100 sdio: use interruptible sleep in kthread main loops My FreeRunner's load average was leveling off at 2.00 as a result of these two kernel threads: SDIO Helper D c02b4500 0 255 2 [<c02b4298>] (schedule+0x0/0x2d4) from [<c02b4040>] (__down+0x100/0x158) [<c02b3f40>] (__down+0x0/0x158) from [<c02b3e2c>] (__down_failed+0xc/0x20) r7:00000000 r6:c01fbd64 r5:c7cb7134 r4:c7d58000 [<c01fa6fc>] (CardDetectHelperFunction+0x0/0x1ac) from [<c01fbd80>] (HelperLaunch+0x1c/0x28) r5:c7cb7134 r4:c7cb7134 [<c01fbd64>] (HelperLaunch+0x0/0x28) from [<c005bbd0>] (kthread+0x60/0x94) r4:c7d58000 [<c005bb70>] (kthread+0x0/0x94) from [<c0048f7c>] (do_exit+0x0/0x744) r6:00000000 r5:00000000 r4:00000000 SDIO Helper D c02b4500 0 259 2 [<c02b4298>] (schedule+0x0/0x2d4) from [<c02b4040>] (__down+0x100/0x158) [<c02b3f40>] (__down+0x0/0x158) from [<c02b3e2c>] (__down_failed+0xc/0x20) r7:c0382bb4 r6:c0382b34 r5:c7d5a000 r4:00000001 [<c01f9104>] (SDIOIrqHelperFunction+0x0/0x29c) from [<c01fbd80>] (HelperLaunch+0x1c/0x28) r8:00000000 r7:00000000 r6:c01fbd64 r5:c0382bb4 r4:c0382bb4 [<c01fbd64>] (HelperLaunch+0x0/0x28) from [<c005bbd0>] (kthread+0x60/0x94) r4:c7d5a000 [<c005bb70>] (kthread+0x0/0x94) from [<c0048f7c>] (do_exit+0x0/0x744) r6:00000000 r5:00000000 r4:00000000 This fixes them to use interruptible sleep primitives while waiting in their main loops, as is conventional for kernel threads. They can't actually be interrupted since kernel threads ignore all signals, but by sleeping this way they get classified as long term waiters, and don't get counted as running for purposes of load average calculation. This is intended as a minimal fix. In the longer term, it'd probably make sense to replace the semaphores with completions or something, and to do away with some of these StudlyCapped wrapper functions. Signed-off-by: Jason Uhlenkott <[EMAIL PROTECTED]> -- This is untested, but what could possibly go wrong? ;)
--- End Message ---
--- Begin Message ---Rebased ref, commits from common ancestor: commit e1fc0cf54f43e33a6eefa78b8b3d77de2518eb89 Author: Mike Westerhof <[EMAIL PROTECTED]> Date: Tue Jul 15 11:43:47 2008 +0100 fix-touchscreen-driver-gta01-missing-includes.patch Add missing initialization for the touchscreen driver for the gta01 platform. Signed-off-by: Mike Westerhof <[EMAIL PROTECTED]> commit 11bd6c2b57f58e92e4caafeab39802c87b4d1c7b Author: Andy Green <[EMAIL PROTECTED]> Date: Tue Jul 15 11:39:01 2008 +0100 test-touchscreen-median.patch Signed-off-by: Andy Green <[EMAIL PROTECTED]> commit b7811b51fd38bd7942838893694f6a14bc73cc49 Author: Andy Green <[EMAIL PROTECTED]> Date: Tue Jul 15 11:39:01 2008 +0100 config-touchscreen-filters.patch Signed-off-by: Andy Green <[EMAIL PROTECTED]> commit 287b292cf95edbd82dc63085ae5f0167a6e8141f Author: Jason Uhlenkott <[EMAIL PROTECTED]> Date: Tue Jul 15 11:37:45 2008 +0100 sdio: use interruptible sleep in kthread main loops My FreeRunner's load average was leveling off at 2.00 as a result of these two kernel threads: SDIO Helper D c02b4500 0 255 2 [<c02b4298>] (schedule+0x0/0x2d4) from [<c02b4040>] (__down+0x100/0x158) [<c02b3f40>] (__down+0x0/0x158) from [<c02b3e2c>] (__down_failed+0xc/0x20) r7:00000000 r6:c01fbd64 r5:c7cb7134 r4:c7d58000 [<c01fa6fc>] (CardDetectHelperFunction+0x0/0x1ac) from [<c01fbd80>] (HelperLaunch+0x1c/0x28) r5:c7cb7134 r4:c7cb7134 [<c01fbd64>] (HelperLaunch+0x0/0x28) from [<c005bbd0>] (kthread+0x60/0x94) r4:c7d58000 [<c005bb70>] (kthread+0x0/0x94) from [<c0048f7c>] (do_exit+0x0/0x744) r6:00000000 r5:00000000 r4:00000000 SDIO Helper D c02b4500 0 259 2 [<c02b4298>] (schedule+0x0/0x2d4) from [<c02b4040>] (__down+0x100/0x158) [<c02b3f40>] (__down+0x0/0x158) from [<c02b3e2c>] (__down_failed+0xc/0x20) r7:c0382bb4 r6:c0382b34 r5:c7d5a000 r4:00000001 [<c01f9104>] (SDIOIrqHelperFunction+0x0/0x29c) from [<c01fbd80>] (HelperLaunch+0x1c/0x28) r8:00000000 r7:00000000 r6:c01fbd64 r5:c0382bb4 r4:c0382bb4 [<c01fbd64>] (HelperLaunch+0x0/0x28) from [<c005bbd0>] (kthread+0x60/0x94) r4:c7d5a000 [<c005bb70>] (kthread+0x0/0x94) from [<c0048f7c>] (do_exit+0x0/0x744) r6:00000000 r5:00000000 r4:00000000 This fixes them to use interruptible sleep primitives while waiting in their main loops, as is conventional for kernel threads. They can't actually be interrupted since kernel threads ignore all signals, but by sleeping this way they get classified as long term waiters, and don't get counted as running for purposes of load average calculation. This is intended as a minimal fix. In the longer term, it'd probably make sense to replace the semaphores with completions or something, and to do away with some of these StudlyCapped wrapper functions. Signed-off-by: Jason Uhlenkott <[EMAIL PROTECTED]> -- This is untested, but what could possibly go wrong? ;)
--- End Message ---
--- Begin Message ---Rebased ref, commits from common ancestor: commit f38f3e0bcc04be0e3f1615bd79b0695740719ae1 Author: Mike Westerhof <[EMAIL PROTECTED]> Date: Tue Jul 15 11:47:02 2008 +0100 clean-gsm-flow-control.patch Signed-off-by: Mike Westerhof <[EMAIL PROTECTED]> arch/arm/plat-s3c24xx/neo1973_pm_gsm.c | 52 +------- drivers/serial/s3c2410.c | 204 +++----------------------------- 2 files changed, 24 insertions(+), 232 deletions(-) commit 0ec5456582615d191fd9f4f7ebcd5c77e3aeeb03 Author: Andy Green <[EMAIL PROTECTED]> Date: Tue Jul 15 11:47:02 2008 +0100 mw09_style_fixes.patch Signed-off-by: Andy Green <[EMAIL PROTECTED]> commit 54eb839d43f8544067e65270d077e2ebdb9a2323 Author: Mike Westerhof <[EMAIL PROTECTED]> Date: Tue Jul 15 11:47:02 2008 +0100 mw09f_gsm_interrupt_handling_4.patch Signed-off-by: Mike Westerhof <[EMAIL PROTECTED]> commit 60a5b47d8f9207d41d5708d628cdf34c07898695 Author: Mike Westerhof <[EMAIL PROTECTED]> Date: Tue Jul 15 11:47:01 2008 +0100 mw09f_gsm_interrupt_handling_3.patch Signed-off-by: Mike Westerhof <[EMAIL PROTECTED]> commit 0507559ee70925bf084de315114f5eaa2a8c3d9f Author: Mike Westerhof <[EMAIL PROTECTED]> Date: Tue Jul 15 11:47:01 2008 +0100 mw09f_gsm_interrupt_handling_2.patch Signed-off-by: Mike Westerhof <[EMAIL PROTECTED]> commit 8332d71b8470c2a91fbb9b9889c6e8971277aeae Author: Mike Westerhof <[EMAIL PROTECTED]> Date: Tue Jul 15 11:47:01 2008 +0100 mw09f_gsm_interrupt_handling_1.patch Signed-off-by: Mike Westerhof <[EMAIL PROTECTED]> commit f85dd691bc41d445ea42a9e870f3483f4b26369f Author: Mike Westerhof <[EMAIL PROTECTED]> Date: Tue Jul 15 11:47:01 2008 +0100 mw09e_gsm_serial_mctrl.patch Signed-off-by: Mike Westerhof <[EMAIL PROTECTED]> commit 4f10d6abfef4fca1a294b173b71299823c9ea933 Author: Mike Westerhof <[EMAIL PROTECTED]> Date: Tue Jul 15 11:47:01 2008 +0100 mw09d_gta01_serial_readhack_1.patch Signed-off-by: Mike Westerhof <[EMAIL PROTECTED]> commit cc9a1bb722b48d82a2e54d86d1985b4ca4aeccc9 Author: Mike Westerhof <[EMAIL PROTECTED]> Date: Tue Jul 15 11:47:01 2008 +0100 mw09c_gsm_flowcontrol.patch Signed-off-by: Mike Westerhof <[EMAIL PROTECTED]> commit dd1e1ffe625d3cb7857274f42985f4bcce077709 Author: Mike Westerhof <[EMAIL PROTECTED]> Date: Tue Jul 15 11:47:00 2008 +0100 mw09a_log_serial_errors.patch Signed-off-by: Mike Westerhof <[EMAIL PROTECTED]> commit b0537b20cb152f66d0b6de927fb8eed54e23b79e Author: Mike Westerhof <[EMAIL PROTECTED]> Date: Tue Jul 15 11:47:00 2008 +0100 mw09a_gta01_UART_threshold.patch Signed-off-by: Mike Westerhof <[EMAIL PROTECTED]> commit 18b03e5c8ceb075b4f5ad46ad977a0fcd2ad3e9c Author: Mike Westerhof <[EMAIL PROTECTED]> Date: Tue Jul 15 11:47:00 2008 +0100 mw09a_gta01_console_disable_2.patch Signed-off-by: Mike Westerhof <[EMAIL PROTECTED]> commit 68378621361f6bc323f1a599606913e878e4d7e7 Author: Mike Westerhof <[EMAIL PROTECTED]> Date: Tue Jul 15 11:47:00 2008 +0100 mw09a_gta01_console_disable_1.patch Signed-off-by: Mike Westerhof <[EMAIL PROTECTED]> commit 2a4a1507e42d04b8d6e484b4338699de49fe8cdf Author: Cesar Eduardo Barros <[EMAIL PROTECTED]> Date: Tue Jul 15 11:47:00 2008 +0100 PATCH-9_9-gta01-Tweak-pixclock-to-reduce-flicker-with-cpufreq.eml Experimenting with a GTA01 showed pixclock values near 40000 (after the rounding caused by the divider calculation) caused visible flicker. Values near 20000 caused only a slight flicker, and the default value after rounding with the default HCLK frequency of 133MHz is 30075. Change the value to 35000 to make it stay in the range 17500-35000 and thus reduce the flicker a bit. Signed-off-by: Cesar Eduardo Barros <[EMAIL PROTECTED]> commit 40094fb818f8ec3d9d93b67771d6cdd852bc0f1c Author: Cesar Eduardo Barros <[EMAIL PROTECTED]> Date: Tue Jul 15 11:46:59 2008 +0100 PATCH-8_9-Experimental-S3C2410A-cpufreq-driver-fb-.eml This is the cpufreq notifier for the S3C2410 framebuffer driver. Signed-off-by: Cesar Eduardo Barros <[EMAIL PROTECTED]> commit c312a8233194a4a08329227174c8d32ecc729a5c Author: Cesar Eduardo Barros <[EMAIL PROTECTED]> Date: Tue Jul 15 11:46:59 2008 +0100 PATCH-7_9-Experimental-S3C2410A-cpufreq-driver-serial-.eml This is the cpufreq notifier for the S3C2410 serial driver. It uses the hardware flow control, when available, to avoid losing characters during the transition. Signed-off-by: Cesar Eduardo Barros <[EMAIL PROTECTED]> commit dfdf4417c48b7a2263366d96cdbad5d784ddf054 Author: Cesar Eduardo Barros <[EMAIL PROTECTED]> Date: Tue Jul 15 11:46:59 2008 +0100 PATCH-6_9-s3c2410-serial-move-divisor-calculation-to-separate-function.eml The cpufreq notifier for the S3C2410 serial driver has to recalculate the baud rate divisor. The code which does the calculation is currently part of s3c24xx_serial_set_termios. Split it off to a separate function. Code movement only, no functional changes. Signed-off-by: Cesar Eduardo Barros <[EMAIL PROTECTED]> commit c0cd46b8ccf5152270fb67f36d48126051c1376a Author: Cesar Eduardo Barros <[EMAIL PROTECTED]> Date: Tue Jul 15 11:46:59 2008 +0100 PATCH-5_9-Experimental-S3C2410A-cpufreq-driver-nand-.eml This is the cpufreq notifier for the S3C2410 NAND driver. Signed-off-by: Cesar Eduardo Barros <[EMAIL PROTECTED]> commit 8e6ebdfd0c3a716e3f835439effd6067dd7a4e77 Author: Cesar Eduardo Barros <[EMAIL PROTECTED]> Date: Tue Jul 15 11:46:59 2008 +0100 PATCH-4_9-Experimental-S3C2410A-cpufreq-driver-timer-.eml This is the cpufreq notifier for the S3C2410 timer code. Signed-off-by: Cesar Eduardo Barros <[EMAIL PROTECTED]> commit 48763b1eed768e0ff808a2193cdd64aefc746a5a Author: Cesar Eduardo Barros <[EMAIL PROTECTED]> Date: Tue Jul 15 11:46:59 2008 +0100 PATCH-3_9-cpufreq-Warn-whem-cpufreq_register_notifier-called-before-pure-initcalls.eml If cpufreq_register_notifier is called before pure initcalls, init_cpufreq_transition_notifier_list will overwrite whatever it did, causing notifiers to be ignored. Print some noise to the kernel log if that happens. Signed-off-by: Cesar Eduardo Barros <[EMAIL PROTECTED]> commit 64a967fed1a142fc9e289a17a84771ae78e8a245 Author: Cesar Eduardo Barros <[EMAIL PROTECTED]> Date: Tue Jul 15 11:46:58 2008 +0100 PATCH-2_9-Experimental-S3C2410A-cpufreq-driver-core-.eml This is a cpufreq driver for the S3C2410A. It deals only with the main frequency switching part and with the SDRAM refresh counter. The rest of the hardware should be dealt with via cpufreq notifiers on each of the drivers. It also has experimental support for the S3C2442. Signed-off-by: Cesar Eduardo Barros <[EMAIL PROTECTED]> commit 9c19a1ec026f412ee41066b5ac74f060431021df Author: Cesar Eduardo Barros <[EMAIL PROTECTED]> Date: Tue Jul 15 11:46:58 2008 +0100 PATCH-1_9-cpufreq-fix-show_trans_table.eml Fix show_trans_table when it overflows PAGE_SIZE. * Not all snprintf calls were protected against being passed a negative length. * When show_trans_table overflows, len might be > PAGE_SIZE. In that case, returns PAGE_SIZE. Signed-off-by: Cesar Eduardo Barros <[EMAIL PROTECTED]> commit 7d3e8d618ad92b20311d1a890a08eb09f6574564 Author: warmcat <[EMAIL PROTECTED]> Date: Tue Jul 15 11:46:58 2008 +0100 local-config-cpufreq.patch commit e1fc0cf54f43e33a6eefa78b8b3d77de2518eb89 Author: Mike Westerhof <[EMAIL PROTECTED]> Date: Tue Jul 15 11:43:47 2008 +0100 fix-touchscreen-driver-gta01-missing-includes.patch Add missing initialization for the touchscreen driver for the gta01 platform. Signed-off-by: Mike Westerhof <[EMAIL PROTECTED]> commit 11bd6c2b57f58e92e4caafeab39802c87b4d1c7b Author: Andy Green <[EMAIL PROTECTED]> Date: Tue Jul 15 11:39:01 2008 +0100 test-touchscreen-median.patch Signed-off-by: Andy Green <[EMAIL PROTECTED]> commit b7811b51fd38bd7942838893694f6a14bc73cc49 Author: Andy Green <[EMAIL PROTECTED]> Date: Tue Jul 15 11:39:01 2008 +0100 config-touchscreen-filters.patch Signed-off-by: Andy Green <[EMAIL PROTECTED]> commit 287b292cf95edbd82dc63085ae5f0167a6e8141f Author: Jason Uhlenkott <[EMAIL PROTECTED]> Date: Tue Jul 15 11:37:45 2008 +0100 sdio: use interruptible sleep in kthread main loops My FreeRunner's load average was leveling off at 2.00 as a result of these two kernel threads: SDIO Helper D c02b4500 0 255 2 [<c02b4298>] (schedule+0x0/0x2d4) from [<c02b4040>] (__down+0x100/0x158) [<c02b3f40>] (__down+0x0/0x158) from [<c02b3e2c>] (__down_failed+0xc/0x20) r7:00000000 r6:c01fbd64 r5:c7cb7134 r4:c7d58000 [<c01fa6fc>] (CardDetectHelperFunction+0x0/0x1ac) from [<c01fbd80>] (HelperLaunch+0x1c/0x28) r5:c7cb7134 r4:c7cb7134 [<c01fbd64>] (HelperLaunch+0x0/0x28) from [<c005bbd0>] (kthread+0x60/0x94) r4:c7d58000 [<c005bb70>] (kthread+0x0/0x94) from [<c0048f7c>] (do_exit+0x0/0x744) r6:00000000 r5:00000000 r4:00000000 SDIO Helper D c02b4500 0 259 2 [<c02b4298>] (schedule+0x0/0x2d4) from [<c02b4040>] (__down+0x100/0x158) [<c02b3f40>] (__down+0x0/0x158) from [<c02b3e2c>] (__down_failed+0xc/0x20) r7:c0382bb4 r6:c0382b34 r5:c7d5a000 r4:00000001 [<c01f9104>] (SDIOIrqHelperFunction+0x0/0x29c) from [<c01fbd80>] (HelperLaunch+0x1c/0x28) r8:00000000 r7:00000000 r6:c01fbd64 r5:c0382bb4 r4:c0382bb4 [<c01fbd64>] (HelperLaunch+0x0/0x28) from [<c005bbd0>] (kthread+0x60/0x94) r4:c7d5a000 [<c005bb70>] (kthread+0x0/0x94) from [<c0048f7c>] (do_exit+0x0/0x744) r6:00000000 r5:00000000 r4:00000000 This fixes them to use interruptible sleep primitives while waiting in their main loops, as is conventional for kernel threads. They can't actually be interrupted since kernel threads ignore all signals, but by sleeping this way they get classified as long term waiters, and don't get counted as running for purposes of load average calculation. This is intended as a minimal fix. In the longer term, it'd probably make sense to replace the semaphores with completions or something, and to do away with some of these StudlyCapped wrapper functions. Signed-off-by: Jason Uhlenkott <[EMAIL PROTECTED]> -- This is untested, but what could possibly go wrong? ;)
--- End Message ---
--- Begin Message ---Author: werner Date: 2008-07-15 13:09:04 +0200 (Tue, 15 Jul 2008) New Revision: 4526 Modified: developers/werner/ahrt/host/tmc/python.c developers/werner/ahrt/host/tmc/tmc.c developers/werner/ahrt/host/tmc/usbtmc.c Log: - usbtmc.c: added support for Rigol-specific protocol variations - usbtmc.c (bulk_write): combined "dump", "usb_bulk_write", and error handling into a single function - python.c (tmc_py_read): return string such that it can also contain NUL characters - tmc.c (tmc_stop): pthread_join so that we race less when sending new commands - tmc.c (launch): allow cancellation just before reading - tmc.c (tmc_start): check if pthread_create fails Modified: developers/werner/ahrt/host/tmc/python.c =================================================================== --- developers/werner/ahrt/host/tmc/python.c 2008-07-14 12:10:43 UTC (rev 4525) +++ developers/werner/ahrt/host/tmc/python.c 2008-07-15 11:09:04 UTC (rev 4526) @@ -139,7 +139,7 @@ static PyObject *tmc_py_read(PyObject *self, PyObject *noarg) { struct py_instr *s = (struct py_instr *) self; - static char buf[BUF_SIZE+1]; + static char buf[BUF_SIZE]; int len; //fprintf(stderr, "tmc_py_read\n"); @@ -152,8 +152,7 @@ ERROR; return NULL; } - buf[len] = 0; - return Py_BuildValue("s", buf); + return Py_BuildValue("s#", buf, len); } Modified: developers/werner/ahrt/host/tmc/tmc.c =================================================================== --- developers/werner/ahrt/host/tmc/tmc.c 2008-07-14 12:10:43 UTC (rev 4525) +++ developers/werner/ahrt/host/tmc/tmc.c 2008-07-15 11:09:04 UTC (rev 4526) @@ -96,6 +96,7 @@ struct tmc_dsc *dsc = arg; while (1) { + pthread_testcancel(); if (dsc->ops->read(dsc->proto_dsc, io_push_async, dsc->io_dsc) < 0) return NULL; @@ -111,6 +112,8 @@ int tmc_start(struct tmc_dsc *dsc, const char *file, const char *repeat) { + int err; + if (dsc->running) { fprintf(stderr, "tmc_start: already running\n"); return -1; @@ -128,7 +131,11 @@ } } dsc->running = 1; - pthread_create(&dsc->thread, NULL, launch, dsc); + err = pthread_create(&dsc->thread, NULL, launch, dsc); + if (err) { + fprintf(stderr, "pthread_create: %s\n", strerror(err)); + return -1; + } return 0; } @@ -145,6 +152,10 @@ if (err) { fprintf(stderr, "pthread_cancel: %s\n", strerror(err)); } + err = pthread_join(dsc->thread, NULL); + if (err) { + fprintf(stderr, "pthread_join: %s\n", strerror(err)); + } dsc->running = 0; io_end_async(dsc->io_dsc); free(dsc->repeat); Modified: developers/werner/ahrt/host/tmc/usbtmc.c =================================================================== --- developers/werner/ahrt/host/tmc/usbtmc.c 2008-07-14 12:10:43 UTC (rev 4525) +++ developers/werner/ahrt/host/tmc/usbtmc.c 2008-07-15 11:09:04 UTC (rev 4526) @@ -66,6 +66,7 @@ uint16_t max_packet; /* maximum ep_bulk_in packet size */ unsigned long timeout; /* timeout in milliseconds */ int retry; /* retry after timeouts */ + int rigol; /* enable Rigol-specific hacks */ void *last_buf; /* last buffer sent */ int last_len; }; @@ -103,7 +104,7 @@ static void multiple_dev(void) { fprintf(stderr, - "multiple devices found. Please add more qualifiers\n"); + "multiple devices found. Please add more qualifiers.\n"); } @@ -213,11 +214,21 @@ const struct usb_config_descriptor *cfg; const struct usb_interface *itf; struct usb_interface_descriptor *alt; + int valid; - if (dev->descriptor.bDeviceClass || - dev->descriptor.bDeviceSubClass || - dev->descriptor.bDeviceProtocol) - return 0; + /* According to USB TMC spec */ + valid = dev->descriptor.bDeviceClass == USB_CLASS_PER_INTERFACE && + !dev->descriptor.bDeviceSubClass && + !dev->descriptor.bDeviceProtocol; + + /* According to Rigol Corp. */ + valid |= dev->descriptor.bDeviceClass == USB_CLASS_VENDOR_SPEC && + dev->descriptor.bDeviceSubClass == 0xff && + dev->descriptor.bDeviceProtocol == 0xff; + + if (!valid) + return 0; + /* seems that libusb doesn't provide the Device_Qualifier descriptor, so we can't sanity-check that one */ @@ -402,7 +413,7 @@ static void usage(void) { fprintf(stderr, - "usage: \"usbtmc\" [, retry] [, timeout=N]\n" + "usage: \"usbtmc\" [, retry] [, rigol] [, timeout=N]\n" " [, bus=N] [, device=N] [, vendor=N] [, product=N]\n"); } @@ -450,6 +461,8 @@ if (*end || !product || product > 0xffff) goto usage; } + else if (!strcmp(argv[i], "rigol")) + d->rigol = 1; else goto usage; } if (open_usbtmc(d, vendor, product, bus, device) < 0) @@ -481,13 +494,31 @@ } +static int bulk_write(void *dsc, const char *label, void *buf, int size) +{ + struct usbtmc_dsc *d = dsc; + int sent; + + dump(label, buf, size); + sent = usb_bulk_write(d->handle, d->ep_bulk_out, buf, size, d->timeout); + if (sent < 0) { + fprintf(stderr, "write error %d\n", sent); + return -1; + } + if (sent != size) { + fprintf(stderr, "sent %d instead of %d bytes\n", sent, size); + return -1; + } + return sent; +} + + static int usbtmc_write(void *dsc, const void *buf, size_t len) { struct usbtmc_dsc *d = dsc; uint8_t tmp[SIZE_IOBUFFER]; char *msg; size_t left, size, send_size; - ssize_t sent; msg = malloc(len); if (!msg) { @@ -511,28 +542,28 @@ tmp[0] = DEV_DEP_MSG_OUT; tmp[1] = d->bTag; tmp[2] = ~d->bTag; + tmp[3] = 0; tmp[4] = size; tmp[5] = size >> 8; tmp[6] = size >> 16; tmp[7] = size >> 24; tmp[9] = tmp[10] = tmp[11] = 0; - memcpy(tmp+12, msg, size); - msg += size; + if (!d->rigol) { + memcpy(tmp+12, msg, size); + msg += size; - send_size = 12+((size+3) & ~3); + send_size = 12+((size+3) & ~3); - dump("SEND: DEV_DEP_MSG_OUT", tmp, send_size); - sent = usb_bulk_write(d->handle, d->ep_bulk_out, (void *) tmp, - send_size, d->timeout); - if (sent < 0) { - fprintf(stderr, "write error %d\n", (int) sent); - return -1; + if (bulk_write(d, "DEV_DEP_MSG_OUT", tmp, send_size) + < 0) + return -1; } - if (sent != send_size) { - fprintf(stderr, "sent %d instead of %d bytes\n", - (int) sent, (int) send_size); - return -1; + else { + if (bulk_write(d, "SEND: DEV_DEP_MSG_OUT", tmp, 12) < 0) + return -1; + if (bulk_write(d, "SEND", msg, size) < 0) + return -1; } } return 0; @@ -544,7 +575,7 @@ struct usbtmc_dsc *d = dsc; uint8_t tmp[SIZE_IOBUFFER]; size_t size; - ssize_t sent, got; + ssize_t got; uint32_t payload; struct timeval tv; int end = 0; @@ -557,28 +588,18 @@ tmp[0] = DEV_DEP_MSG_IN; tmp[1] = d->bTag; tmp[2] = ~d->bTag; + tmp[3] = 0; tmp[4] = size; tmp[5] = size >> 8; tmp[6] = size >> 16; tmp[7] = size >> 24; tmp[8] = tmp[9] = tmp[10] = tmp[11] = 0; - dump("SEND: DEV_DEP_MSG_IN", tmp, 12); - sent = - usb_bulk_write(d->handle, d->ep_bulk_out, (void *) tmp, 12, - d->timeout); - if (sent < 0) { - fprintf(stderr, "write error %d\n", (int) sent); + if (bulk_write(d, "SEND: DEV_DEP_MSG_IN", tmp, 12) < 0) return -1; - } - if (sent != 12) { - fprintf(stderr, "sent %d instead of 12 bytes\n", - (int) sent); - return -1; - } got = usb_bulk_read(d->handle, d->ep_bulk_in, (void *) tmp, - size, d->timeout); + d->rigol ? 64 : size, d->timeout); if (got < 0) { usbtmc_abort_in(d); fprintf(stderr, "read error %d\n", (int) got); @@ -645,6 +666,12 @@ return -1; } + if (d->rigol && payload > 64-12) { + got = usb_bulk_read(d->handle, d->ep_bulk_in, + (void *) tmp+64-12, payload-12, d->timeout); + dump("RECV", tmp+64-12, got); + } + end = tmp[8] & 1; push(push_dsc, &tv, tmp+12, payload, end); } @@ -665,7 +692,10 @@ if (debug) fprintf(stderr, "DCI\n"); //usbtmc_clear(d); - usbtmc_abort_in(d); + if (d->rigol) + usb_reset(d->handle); + else + usbtmc_abort_in(d); //usbtmc_abort_out(d); return 0; }
--- End Message ---
_______________________________________________ commitlog mailing list commitlog@lists.openmoko.org http://lists.openmoko.org/mailman/listinfo/commitlog