[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [coldsync-hackers] New snapshot: 2.2.0
On Mon, 30 Jul 2001 23:44:05 EDT, Andrew Arensburger <arensb+CShackers@ooblick.com> wrote:
> I've uploaded a new ColdSync snapshot, version 2.2.0:
>http://www.ooblick.com/software/coldsync/coldsync-2.2.0-20010730.tar.gz
I finally found the time to give this a shot. It doesn't work
any better for me that my previous (bounced) diffs. coldsync
never receives the first ritual message. I don't know what's
going on, but I suspect the data is getting lost in the kernel
due to the bulk mode aspect of the USB device. As soon as my
other computer returns to me, I'll do a bit of kernel instrumenting
and see if I can trace the data.
Though I like the new protocol specification changes, I still think
there's too much co-mingling of FreeBSD specific USB code and
communication protocol in PConnection_usb.c. I think this will
cause problems if we ever try to port to another OS that
does real USB (as opposed to the Linux USB/Serial method) differently
than FreeBSD. I think it also obscures the separation between
the USB stuff (locating an endpoint) and the different communication
protocol handling (padp_tini, etc.).
Just my $0.02. I still think coldsync is a nice bit of work.
The protocol switch statement works well for the initialization,
but there are many exit paths in the function that are hard-coded
to only unwind the full/default stack. I've marked them (at least
some) in the following diff, but did not insert the switch statement
to actually fix the problem. I don't know how you feel about
gotos for error exit conditions. Personally I don't like them,
though they might be appropriate here if you want to handle
all the different palm sync protocols in the USB file.
I've also made a couple trivial changes:
Don't warn that a Palm is not a Visor
Don't perform an ioctl if the open failed
Loop until the primary device appears since it won't
get created under FreeBSD 5.x until HotSync is started
mike
--- ../coldsync-vendor/libpconn/PConnection_usb.c Tue Aug 7 20:31:05 2001
+++ libpconn/PConnection_usb.c Tue Aug 7 20:37:18 2001
@@ -94,6 +94,7 @@
#define hs_usbfun_MAX 4
#define HANDSPRING_VENDOR_ID 0x082d
+#define PALM_VENDOR_ID 0x0830
static char *hs_usb_functions[] = {
"Generic",
@@ -430,7 +431,12 @@
IO_TRACE(1)
perror(device);
- if (errno != ENXIO) {
+ /*
+ * This file won't exist under FreeBSD 5.x until
+ * HotSync is started on the device. We'll need
+ * to retry until it appears.
+ */
+ if (errno != ENXIO && errno != ENOENT) {
fprintf(stderr, _("Error: Can't open \"%s\".\n"),
device);
perror("open");
@@ -443,23 +449,13 @@
}
/*
- * If we've enabled trace for I/O, then poke the USB kernel
- * driver to turn on the minimal amount of tracing. This can
- * fail if the kernel wasn't built with UGEN_DEBUG defined, so
- * we just ignore any error which might occur.
- */
- IO_TRACE(1)
- i = 1;
- else
- i = 0;
- (void) ioctl(usb_ep0, USB_SETDEBUG, &i);
-
-
- /*
* Open the control endpoint of the USB device. We'll use this
* to figure out if the device in question is the one we are
* interested in and understand, and then to configure it in
* preparation of doing I/O for the actual hot sync operation.
+ *
+ * Check for a failed open before we perform the following
+ * ioctl(2). mbd
*/
if (usb_ep0 < 0) {
fprintf(stderr, _("%s: Can't open USB device.\n"),
@@ -468,12 +464,31 @@
free(u);
u = pconn->io_private = NULL;
+ /*
+ * XXX
+ * This only applies to a Visor device. We need a
+ * protocol switch here.
+ */
dlp_tini(pconn);
padp_tini(pconn);
slp_tini(pconn);
return -1;
}
+ /*
+ * If we've enabled trace for I/O, then poke the USB kernel
+ * driver to turn on the minimal amount of tracing. This can
+ * fail if the kernel wasn't built with UGEN_DEBUG defined, so
+ * we just ignore any error which might occur.
+ */
+ IO_TRACE(1)
+ i = 1;
+ else
+ i = 0;
+ (void) ioctl(usb_ep0, USB_SETDEBUG, &i);
+
+
+
if (ioctl(usb_ep0, USB_GET_DEVICEINFO, &udi)) {
fprintf(stderr,
_("%s: Can't get information about USB device.\n"),
@@ -483,6 +498,11 @@
free((void *)u);
u = pconn->io_private = NULL;
+ /*
+ * XXX
+ * This only applies to a Visor device. We need a
+ * protocol switch here.
+ */
dlp_tini(pconn);
padp_tini(pconn);
slp_tini(pconn);
@@ -505,7 +525,8 @@
}
- if (udi.vendorNo != HANDSPRING_VENDOR_ID) {
+ if (udi.vendorNo != HANDSPRING_VENDOR_ID && udi.vendorNo !=
+ PALM_VENDOR_ID) {
fprintf(stderr,
_("%s: Warning: Unexpected USB vendor ID %#x.\n"),
"pconn_usb_open", udi.vendorNo);
@@ -555,6 +576,11 @@
free((void *)u);
u = pconn->io_private = NULL;
+ /*
+ * XXX
+ * This only applies to a Visor device. We need a
+ * protocol switch here.
+ */
dlp_tini(pconn);
padp_tini(pconn);
slp_tini(pconn);
@@ -596,6 +622,11 @@
free((void *)u);
u = pconn->io_private = NULL;
+ /*
+ * XXX
+ * This only applies to a Visor device. We need a
+ * protocol switch here.
+ */
dlp_tini(pconn);
padp_tini(pconn);
slp_tini(pconn);
@@ -656,6 +687,11 @@
free((void *)u);
u = pconn->io_private = NULL;
+ /*
+ * XXX
+ * This only applies to a Visor device. We need a
+ * protocol switch here.
+ */
dlp_tini(pconn);
padp_tini(pconn);
slp_tini(pconn);
@@ -668,7 +704,10 @@
fprintf(stderr, "Hotsync endpoint name: \"%s\"\n",
SURE(hotsync_ep_name));
- /* XXX - Under FreeBSD 5.x, this might not exist yet */
+ /*
+ * XXX - Under FreeBSD 5.x, this might not exist yet
+ * If the other device exists (ugen0) then this one exists - mbd
+ */
pconn->fd = open(hotsync_ep_name, O_RDWR, 0);
if (pconn->fd < 0) {
@@ -680,6 +719,11 @@
free((void *)u);
u = pconn->io_private = NULL;
+ /*
+ * XXX
+ * This only applies to a Visor device. We need a
+ * protocol switch here.
+ */
dlp_tini(pconn);
padp_tini(pconn);
slp_tini(pconn);
This message was sent through the coldsync-hackers mailing list. To remove
yourself from this mailing list, send a message to majordomo@thedotin.net
with the words "unsubscribe coldsync-hackers" in the message body. For more
information on Coldsync, send mail to coldsync-hackers-owner@thedotin.net.