GNOME Bugzilla – Bug 385434
a warning dialog will be displayed when device is set to usb:
Last modified: 2007-01-11 09:04:20 UTC
Please describe the problem: When using the latest gnome-pilot pkgs for Solaris USB port on X86 and SPARC platform,a warning dialog will be displayed when device is set to usb:. 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.In Device Settings page of the druid window, set the Type as USB, Device as usb: and left the others as original 4 press Forward button Actual results: a warning dialog will be displayed, "Failed To find directory /sys/bus/usb/devices or read file /proc/bus/usb/devices. Check that usbfs or sysfs is mounted." Expected results: these settings should be passed Does this happen every time? Yes. Other information: On Solaris box
Created attachment 78284 [details] [review] patch for this bug
Jerry, I'm not familiar with solaris, but how does gpilotd detect a USB device? My understanding of the gpilotd code is that either we have HAL (in which case the above warning isn't compiled in) or we poll usbfs to see if a known device has appeared. In this latter case, we display a warning if usbfs isn't found. I'd like to understand how device detection happens on Solaris before applying your patch.
Sorry for slow responding. I tested on my Suse Linux box, the file "/proc/bus/usb/devices" and the directory "/sys/bus/usb/devices" has already existed before I plugged in the Palm device, and there's no change for them after I plugged in the Palm and did a synchronization. The file "/proc/bus/usb/devices_please-use-sysfs-instead" didn't appear if I plugged in the Palm or not. So I think perhaps these codes didn't do what they should do. #ifndef WITH_HAL } else if (device->type == PILOT_DEVICE_USB_VISOR) { /* check sysfs or usbfs is mounted */ if(stat(sysfs_dir, &buf) != 0 && ((stat (usbdevicesfile_str, &buf) != 0 && stat ("/proc/bus/usb/devices_please-use-sysfs-instead", &buf) != 0) || !(S_ISREG(buf.st_mode)) || !(buf.st_mode & S_IRUSR))) { str = g_strdup_printf ( _("Failed to find directory %s or read file %s. " "Check that usbfs or sysfs is mounted."), sysfs_dir, usbdevicesfile_str); error_dialog (NULL, str); g_free (str); return FALSE; } #endif
The file "/proc/bus/usb/devices_please-use-sysfs-instead" is, I believe, specific to certain SuSE patched kernels. It's probably obsolete now. The /proc/bus/usb/devices file, if it exists, should contain an entry for a palm device while a sync is in progress. This /proc/bus/usb/devices file was how gnome-pilot detected USB devices in all versions up to and including 2.0.13. I'd be very surprised if the file isn't being updated when a new USB device appears. It is, just about, possible that SuSE have broken the devices file interface, I suppose. It is deprecated, which is why we've migrated to HAL and sysfs. /sys/bus/usb/devices contains symlinks to (on my Ubuntu system) /sys/devices/ directories, so things like 'find /sys/bus/usb/devices' won't show details. Again, if a new device appears, a new directory should appear there. E.g. on my system, when I plug in a USB printer I get (in dmesg): " usb 1-1.4: new full speed USB device " and a directory: /sys/bus/usb/devices/1-1.4 So, check again whether a new directory appears in /sys/bus/usb/devices when you start a sync on SuSE.
you are right, a new directory appears in /sys/bus/usb/devices when a sync is in progress on my SuSE box. However, there's no usb devices file and directory on Solaris which are similar with "/proc/bus/usb/devices" and "/sys/bus/usb/devices" on Linux. So it's not necessary to check them on Solaris.
Okay. So how, on solaris, does gpilotd decide to sync? Or does it attempt a sync every 2 seconds (i.e. every 'visor_devices_timeout') ?
Currently gpilotd attempt a sync every 2 seconds on Solaris. However in the future when HAL works well on solaris, gpilotd will use HAL to detect the devices automatically by enabling --with-hal .
Fixed in head (i.e. subversion trunk).
Thanks Matt.