After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 385426 - Gpilotd fails in its second or third connection to Palm
Gpilotd fails in its second or third connection to Palm
Status: RESOLVED NOTGNOME
Product: gnome-pilot
Classification: Other
Component: gpilotd
2.0.15
Other All
: Normal blocker
: ---
Assigned To: gnome-pilot Maintainers
gnome-pilot Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-12-13 12:31 UTC by Jerry Yu
Modified: 2007-02-12 10:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
a patch for this bug (433 bytes, patch)
2006-12-13 12:35 UTC, Jerry Yu
none Details | Review

Description Jerry Yu 2006-12-13 12:31:07 UTC
Please describe the problem:
When using the latest gnome-pilot pkgs for Solaris USB port on X86 and SPARC platform, Gpilotd fails in its second or third connection to Palm.



Steps to reproduce:
1.Connect one Palm device such as Palm treo 600 with X86 or SPARC machine by USB port. Installed Solaris NV53, pilot-link-0.12.1 and Gnome-Pilot-2.0.15 pkgs for USB port.
2.Start Gnome-Pilot GUI with command gpilotd-control-applet.
3.Correctly set the Gnome Pilot Settings and then press Sync buton on Palm. Gpilotd works well in its first connection to Palm,but it fails in the second or third connection.


Actual results:
Error occus on on desktop as follows:
The Pilot Settings has no action.
At the same time, error occurs on palm as follows:
The connection between your device and the desktop could not be established. Please check your setup and try again.

Expected results:
Each connection should be successful.

Does this happen every time?
Yes.

Other information:
 Only on Solaris box.
Comment 1 Jerry Yu 2006-12-13 12:35:28 UTC
Created attachment 78282 [details] [review]
a patch for this bug
Comment 2 Matt Davey 2006-12-13 13:54:28 UTC
Jerry, I don't understand your patch.  What is it doing?

Your patch treats sd==0 as an error.  I don't think sd == 0 should occur, and even if it did, it shouldn't be an error.

Looking in the pilot-link source (libpisock/socket.c), the pi_accept_to call
should return the non-negative socket fd of the accepted connection, or a pilot-link error code  (which is negative).

Are you seeing pi_accept_to return zero on an error condition?  Have you got a patched applied to your version of pilot-link-0.12.1?
Comment 3 André Klapper 2006-12-14 02:51:54 UTC
NEEDINFO state.
Jerry, please reopen this bug report when answering Matt's question. Thanks.
Comment 4 Jerry Yu 2006-12-29 10:10:44 UTC
Hi, Matt

  The stack of pi_accept_to on Solaris is different from on Linux. Below is the one on Solaris:
  [1] u_read_i(ps = 0x8138b38, buf = (nil), len = 1U, flags = 1, timeout = 1000), line 532 in "libusb.c"
  [2] u_poll(ps = 0x8138b38, timeout = 1000), line 419 in "libusb.c"
  [3] pi_usb_accept(ps = 0x8138b38, addr = (nil), addrlen = (nil)), line 414 in "usb.c"
  [4] pi_accept_to(pi_sd = 19, addr = (nil), addrlen = (nil), timeout = 2), line 1108 in "socket.c"
  [5] pilot_connect(device = 0x80f7bd0, error = 0x80476b0), line 253 in "gpilotd.c"
  [6] sync_device(device = 0x80f7bd0, context = 0x80f7b60), line 738 in "gpilotd.c"
  [7] visor_devices_timeout(data = 0x80f7b60), line 1384 in "gpilotd.c"
  [8] g_timeout_dispatch(0x80f8f68, 0x805a930, 0x80f7b60), at 0xfd2bc030
  [9] g_main_dispatch(0x809d548), at 0xfd2b96cc
  [10] g_main_context_dispatch(0x809d548), at 0xfd2ba7b5
  [11] g_main_context_iterate(0x809d548, 0x1, 0x1, 0x807c5b0), at 0xfd2babd5
  [12] g_main_context_iteration(0x809d548, 0x1), at 0xfd2bae30
  [13] wait_for_sync_and_sync(), line 1565 in "gpilotd.c"
  [14] main(argc = 1, argv = 0x80479c4), line 1626 in "gpilotd.c"

the return value of u_read_i is "len". "len" equals to 0 when the 2nd connection is being tried on Solaris. Then all of the return values of u_poll, pi_usb_accept and pi_accept_to equal to 0. If sd isn't set to "<= 0" in pilot_connect as the patch did, *error will equal to 0. If sd is set to "<= 0", *error will equal to 2. Different value of *error will cause sync_device do different action.
Comment 5 Matt Davey 2007-01-14 11:44:23 UTC
Jerry,
I don't know what is causing this, but it doesn't look like
a bug in gnome-pilot to me.  Take a look at the pi_usb_accept code
in pilot-link.  Specifically, the linux-specific code around line 410
in libpisock/usb.c might be required for solaris.

There's definitely a bug in the pilot-link API which is worth raising with
the pilot-link guys, as follows:
  pi_usb_accept is supposed to return the socket descriptor of the accepted connection, or a pilot-link error code.  But if u_poll returns "0", then pi_usb_accept returns zero without completing the accept logic.  Now, a return code of zero isn't part of the pi-error API and is, in principle, a valid socket descriptor so shouldn't be returned by pi_usb_accept.

So, I think the solution to your issue lies in pi_usb_accept, and there are probably two bugs:
1. Apply the linux-specific code to solaris, too.  (not sure if this is what
   you want).
2. Don't return zero as an error code from pi_usb_accept.  Instead, in those
   cases pi_usb_accept should return some appropriate error code from
   pi-error.h

I've just opened a bug on pilot-link.org, with a proposed patch, here:
http://bugs.pilot-link.org/1782

Closing this bug as NOTGNOME.
Comment 6 Jerry Yu 2007-01-17 05:23:39 UTC
thanks Matt. Agree with you that it should be the pilot-link bugs We tend to apply your 2nd way, that is, your proposed patch.

BTW, seems that pilot-link community is not very active, for there are no response sfor two bugs I reported two months ago.
Comment 7 Matt Davey 2007-01-17 08:20:22 UTC
I haven't seen much activity on the pilot-link mailing lists recently.

There is an irc channel on pilot-link.org where a bunch of the developers usually hang out, so if you wanted to encourage them along, that might be the place to go...
Comment 8 Matt Davey 2007-02-09 14:41:00 UTC
The pilot-link bug has been resolved, and the fix will appear in pilot-link 0.12.2.
Comment 9 Jerry Yu 2007-02-12 10:32:28 UTC
Great!
Thanks Matt!