Fwd: Re: calibre: kindle usb connection problem

Hans Petter Selasky hselasky at c2i.net
Sun Apr 1 21:13:25 UTC 2012


On Saturday 31 March 2012 21:21:11 Joe Marcus Clarke wrote:
> On 3/29/12 1:46 PM, Andriy Gapon wrote:
> 
> I wonder if this is a conflict between what hal is doing when it probes
> the device and interface vs. what USB wants to do to attach the device.
>  I'm copying hps to see if he can shed some light on this.  hps, please
> see below where I attempt to highlight what hald is doing.  From reading
> the USB code, I think hald might be triggering an error on attach and
> causing the USB stack to free the device.  Perhaps some USB-level
> debugging is required.
> 
> Joe
> 
> > Not sure if the problem is caused by something in the device or by one of
> > the hal's utilities.
> > This is what I see in the system log:
> > Mar 29 20:37:20 trant kernel: ugen2.2: <Amazon> at usbus2
> > Mar 29 20:37:20 trant kernel: umass0: <Mass Storage> on usbus2
> > Mar 29 20:37:20 trant kernel: ugen2.2: <Amazon> at usbus2 (disconnected)
> > Mar 29 20:37:20 trant kernel: umass0: at uhub2, port 6, addr 2
> > (disconnected) Mar 29 20:37:22 trant kernel: ugen2.2: <Amazon> at usbus2
> > Mar 29 20:37:22 trant kernel: umass0: <Mass Storage> on usbus2
> > Mar 29 20:37:22 trant kernel: da0 at umass-sim0 bus 0 scbus8 target 0 lun
> > 0 Mar 29 20:37:22 trant kernel: da0: <Kindle Internal Storage 0100>
> > Removable Direct Access SCSI-2 device
> > Mar 29 20:37:22 trant kernel: da0: 40.000MB/s transfers
> > Mar 29 20:37:22 trant kernel: da0: 3090MB (6328768 512 byte sectors: 255H
> > 63S/T 393C)
> > 
> > Note how the umass driver attaches, then immediately detaches and two
> > seconds later attaches again.
> > Here's hald output from that period:
> > 
> > 20:37:17.378 [I] hf-devd.c:316: received devd event: !system=DEVFS
> > subsystem=CDEV type=CREATE cdev=usb/2.2.0^M
> > 20:37:17.378 [I] hf-devd.c:316: received devd event: !system=DEVFS
> > subsystem=CDEV type=CREATE cdev=ugen2.2^M
> > 20:37:19.448 [I] hf-devd.c:316: received devd event: !system=DEVFS
> > subsystem=CDEV type=CREATE cdev=usb/2.2.1^M
> > 20:37:20.576 [I] hf-devd.c:316: received devd event: !system=USB
> > subsystem=DEVICE type=ATTACH ugen=ugen2.2 cdev=ugen2.2 vendor=0x1949
> > product=0x0004 devclass=0x00 devsubclass=0x00 sernum="B008A0A00527517D"
> > release=0x0100 mode=host port=6 parent=ugen2.1^M
> > 20:37:20.577 [I] hf-usb2.c:213: received devd attach event, device
> > ugen=ugen2.2^M Run started hald-probe-usb2-device (20000) (0) ^M
> > !  full path is '/usr/local/libexec/hald-probe-usb2-device', program_dir
> > is '/usr/local/libexec'^M
> 
> At this point, hald probes the ugen device and calls the following
> functions:
> 
> libusb20_be_alloc_default
> libusb20_be_device_foreach
>  libusb20_dev_get_bus_number
>  libusb20_dev_get_address
>  libusb20_dev_open
>  libusb20_dev_get_device_desc
>  libusb20_dev_get_config_index
>  libusb20_dev_alloc_config
>  libusb20_dev_req_string_simple_sync
>  libusb20_dev_get_speed
>  libusb20_dev_close
> libusb20_be_free
> 
> > pid 70609: rc=0 signaled=0: /usr/local/libexec/hald-probe-usb2-device^M
> > 20:37:22.640 [I] hald.c:108: Added device to GDL;
> 
> After the device probe runs, the interface prober will execute.  These
> probe helpers run synchronously.
> 
> > udi=/org/freedesktop/Hal/devices/usb_device_1949_4_B008A0A00527517D^M
> > Run started hald-probe-usb2-interface (20000) (0) ^M
> 
> The interface prober runs the following functions:
> 
> libusb20_be_alloc_default
> libusb20_be_device_foreach
>  libusb20_dev_get_bus_number
>  libusb20_dev_get_address
>  libusb20_dev_get_config_index
>  libusb20_dev_get_config_index

Hi,

I think you need to open the device to be allowed to call 
libusb20_dev_req_string_simple_sync, like shown in the previous function call 
list.

Does that make sense to you?

--HPS

>  libusb20_dev_req_string_simple_sync
>  libusb20_dev_get_iface_desc
> libusb20_be_free
> 
> > !  full path is '/usr/local/libexec/hald-probe-usb2-interface',
> > program_dir is '/usr/local/libexec'^M
> > pid 70610: rc=0 signaled=0:
> > /usr/local/libexec/hald-probe-usb2-interface^M 20:37:22.665 [I]
> > hald.c:108: Added device to GDL;
> > udi=/org/freedesktop/Hal/devices/usb_device_1949_4_B008A0A00527517D_if0^M
> > 20:37:22.666 [I] hf-devd.c:316: received devd event: !system=USB
> > subsystem=INTERFACE type=ATTACH ugen=ugen2.2 cdev=ugen2.2 vendor=0x1949
> > product=0x0004 devclass=0x00 devsubclass=0x00 sernum="B008A0A00527517D"
> > release=0x0100 mode=host interface=0 endpoints=2 intclass=0x08
> > intsubclass=0x06 intprotocol=0x50^M
> > 20:37:22.666 [I] hf-devd.c:316: received devd event: +umass0 at bus=1
> > hubaddr=6 port=2 devaddr=2 interface=0 vendor=0x1949 product=0x0004
> > devclass=0x00 devsubclass=0x00 sernum="B008A0A00527517D" release=0x0100
> > mode=host intclass=0x08 intsubclass=0x06 intprotocol=0x50  on uhub2^M
> > 20:37:22.671 [I] hald.c:108: Added device to GDL;
> > udi=/org/freedesktop/Hal/devices/usb_device_1949_4_B008A0A00527517D_if0_s
> > csi_host^M 20:37:22.681 [I] hf-devd.c:316: received devd event:
> > !system=USB subsystem=DEVICE type=DETACH ugen=ugen2.2 cdev=ugen2.2
> > vendor=0x1949 product=0x0004 devclass=0x00 devsubclass=0x00
> > sernum="B008A0A00527517D" release=0x0100 mode=host port=6
> > parent=ugen2.1^M
> > 20:37:22.681 [I] hf-usb2.c:221: received devd detach event, device
> > ugen=ugen2.2^M 20:37:22.682 [I] hald.c:143: Removed device from GDL;
> > udi=/org/freedesktop/Hal/devices/usb_device_1949_4_B008A0A00527517D_if0_s
> > csi_host^M 20:37:22.682 [I] hald.c:143: Removed device from GDL;
> > udi=/org/freedesktop/Hal/devices/usb_device_1949_4_B008A0A00527517D_if0^M
> > 20:37:22.683 [I] hald.c:143: Removed device from GDL;
> > udi=/org/freedesktop/Hal/devices/usb_device_1949_4_B008A0A00527517D^M
> > 20:37:22.685 [I] hf-devd.c:316: received devd event: !system=USB
> > subsystem=INTERFACE type=DETACH ugen=ugen2.2 cdev=ugen2.2 vendor=0x1949
> > product=0x0004 devclass=0x00 devsubclass=0x00 sernum="B008A0A00527517D"
> > release=0x0100 mode=host interface=0 endpoints=2 intclass=0x08
> > intsubclass=0x06 intprotocol=0x50^M
> > 20:37:22.685 [I] hf-devd.c:316: received devd event: !system=DEVFS
> > subsystem=CDEV type=DESTROY cdev=ugen2.2^M
> > 20:37:23.188 [I] hald.c:108: Added device to GDL;
> > udi=/org/freedesktop/Hal/devices/computer_scsi_host_6^M
> > 20:37:23.190 [I] hald.c:108: Added device to GDL;
> > udi=/org/freedesktop/Hal/devices/computer_scsi_host_6_scsi_device_lun0^M
> > Run started hald-probe-scsi (20000) (0) ^M
> > 
> > 
> > Note how computer_scsi_host_6 device is getting inserted when
> > usb_device_1949_4_B008A0A00527517D_if0_scsi_host is removed.
> > I think that this is where the USB ancestry information is lost.
> > 
> > on 29/03/2012 20:26 Andriy Gapon said the following:
> >> -------- Original Message --------
> >> Message-ID: <4F749AD1.7020703 at FreeBSD.org>
> >> Date: Thu, 29 Mar 2012 20:24:33 +0300
> >> From: Andriy Gapon <avg at FreeBSD.org>
> >> Subject: Re: calibre: kindle usb connection problem
> >> References: <4F749941.8070704 at FreeBSD.org>
> >> 
> >> on 29/03/2012 20:17 Andriy Gapon said the following:
> >>> Looks like calibre is no longer able to detect my Kindle via USB
> >>> (calibre is at version 0.8.40).
> >>> The problem seems to be that the umass<->da relationship is not
> >>> reflected in the HAL device hierarchy in the way that calibre expects.
> >> 
> >>> This is the ancestry line for the Kindle da device:
> >> Now even weirder stuff.  I disconnected/reconnected the Kindle and now
> >> it is directly under the computer device:
> >> udi = '/org/freedesktop/Hal/devices/computer_storage'
> >> 
> >>   block.device = '/dev/da0'  (string)
> >>   block.is_volume = false  (bool)
> >>   block.major = 0  (0x0)  (int)
> >>   block.minor = 232  (0xe8)  (int)
> >>   block.storage_device = '/org/freedesktop/Hal/devices/computer_storage'
> >>    (string) freebsd.device_file = '/dev/da0'  (string)
> >>   freebsd.driver = 'da'  (string)
> >>   freebsd.unit = 0  (0x0)  (int)
> >>   info.capabilities = {'block', 'storage'} (string list)
> >>   info.category = 'storage'  (string)
> >>   info.parent = '/org/freedesktop/Hal/devices/computer'  (string)
> >>   info.product = 'Storage Device'  (string)
> >>   info.subsystem = 'block'  (string)
> >>   info.udi = '/org/freedesktop/Hal/devices/computer_storage'  (string)
> >>   storage.automount_enabled_hint = true  (bool)
> >>   storage.bus = 'platform'  (string)
> >>   storage.drive_type = 'disk'  (string)
> >>   storage.hotpluggable = false  (bool)
> >>   storage.media_check_enabled = false  (bool)
> >>   storage.model = ''  (string)
> >>   storage.no_partitions_hint = false  (bool)
> >>   storage.originating_device = ''  (string)
> >>   storage.removable = false  (bool)
> >>   storage.removable.support_async_notification = false  (bool)
> >>   storage.requires_eject = false  (bool)
> >>   storage.vendor = ''  (string)
> >> 
> >> camcontrol sees it properly:
> >> amcontrol devlist -v
> >> scbus0 on ahcich0 bus 0:
> >> <ST3500410AS CC34>                 at scbus0 target 0 lun 0 (pass0,ada0)
> >> <>                                 at scbus0 target -1 lun -1 ()
> >> scbus1 on ahcich1 bus 0:
> >> <ST3500418AS CC34>                 at scbus1 target 0 lun 0 (pass1,ada1)
> >> <>                                 at scbus1 target -1 lun -1 ()
> >> scbus2 on ahcich2 bus 0:
> >> <WDC WD4000AAKS-00YGA0 12.01C02>   at scbus2 target 0 lun 0 (pass2,ada2)
> >> <>                                 at scbus2 target -1 lun -1 ()
> >> scbus3 on ahcich3 bus 0:
> >> <>                                 at scbus3 target -1 lun -1 ()
> >> scbus4 on ahcich4 bus 0:
> >> <>                                 at scbus4 target -1 lun -1 ()
> >> scbus5 on ahcich5 bus 0:
> >> <Optiarc DVD RW AD-7191S 1.02>     at scbus5 target 0 lun 0 (pass3,cd0)
> >> <>                                 at scbus5 target -1 lun -1 ()
> >> scbus6 on ata0 bus 0:
> >> <>                                 at scbus6 target -1 lun -1 ()
> >> scbus7 on sbp0 bus 0:
> >> <>                                 at scbus7 target -1 lun -1 ()
> >> scbus8 on umass-sim0 bus 0:
> >> <Kindle Internal Storage 0100>     at scbus8 target 0 lun 0 (da0,pass4)
> >> scbus-1 on xpt0 bus 0:
> >> <>                                 at scbus-1 target -1 lun -1 (xpt0)
> >> 
> >>> udi = '/org/freedesktop/Hal/devices/computer_scsi_host_6'
> >>> 
> >>>   info.parent = '/org/freedesktop/Hal/devices/computer'  (string)
> >>>   info.product = 'SCSI Host Adapter'  (string)
> >>>   info.subsystem = 'scsi_host'  (string)
> >>>   info.udi = '/org/freedesktop/Hal/devices/computer_scsi_host_6' 
> >>>   (string) scsi_host.host = 8  (0x8)  (int)
> >>> 
> >>> udi =
> >>> '/org/freedesktop/Hal/devices/computer_scsi_host_6_scsi_device_lun0'
> >>> 
> >>>   info.parent = '/org/freedesktop/Hal/devices/computer_scsi_host_6' 
> >>>   (string) info.product = 'SCSI Device'  (string)
> >>>   info.subsystem = 'scsi'  (string)
> >>>   info.udi =
> >>> 
> >>> '/org/freedesktop/Hal/devices/computer_scsi_host_6_scsi_device_lun0' 
> >>> (string)
> >>> 
> >>>   info.vendor = 'Kindle'  (string)
> >>>   scsi.bus = 8  (0x8)  (int)
> >>>   scsi.host = 8  (0x8)  (int)
> >>>   scsi.lun = 0  (0x0)  (int)
> >>>   scsi.model = 'Internal Storage'  (string)
> >>>   scsi.target = 0  (0x0)  (int)
> >>>   scsi.type = 'disk'  (string)
> >>>   scsi.vendor = 'Kindle'  (string)
> >>> 
> >>> udi = '/org/freedesktop/Hal/devices/storage_model_Internal_Storage'
> >>> 
> >>>   block.device = '/dev/da0'  (string)
> >>>   block.freebsd.cam_path = '8,0,0'  (string)
> >>>   block.is_volume = false  (bool)
> >>>   block.major = 0  (0x0)  (int)
> >>>   block.minor = 232  (0xe8)  (int)
> >>>   block.storage_device =
> >>> 
> >>> '/org/freedesktop/Hal/devices/storage_model_Internal_Storage'  (string)
> >>> 
> >>>   freebsd.device_file = '/dev/da0'  (string)
> >>>   freebsd.driver = 'da'  (string)
> >>>   freebsd.unit = 0  (0x0)  (int)
> >>>   info.addons = {'hald-addon-storage'} (string list)
> >>>   info.capabilities = {'block', 'storage'} (string list)
> >>>   info.category = 'storage'  (string)
> >>>   info.interfaces = {'org.freedesktop.Hal.Device.Storage.Removable'}
> >>>   (string list) info.parent =
> >>> 
> >>> '/org/freedesktop/Hal/devices/computer_scsi_host_6_scsi_device_lun0' 
> >>> (string)
> >>> 
> >>>   info.product = 'Internal Storage'  (string)
> >>>   info.subsystem = 'block'  (string)
> >>>   info.udi =
> >>>   '/org/freedesktop/Hal/devices/storage_model_Internal_Storage' 
> >>>   (string) info.vendor = 'Kindle'  (string)
> >>>   storage.automount_enabled_hint = true  (bool)
> >>>   storage.bus = 'scsi'  (string)
> >>>   storage.drive_type = 'disk'  (string)
> >>>   storage.firmware_revision = '0100'  (string)
> >>>   storage.hotpluggable = false  (bool)
> >>>   storage.lun = 0  (0x0)  (int)
> >>>   storage.media_check_enabled = true  (bool)
> >>>   storage.model = 'Internal Storage'  (string)
> >>>   storage.no_partitions_hint = false  (bool)
> >>>   storage.originating_device =
> >>> 
> >>> '/org/freedesktop/Hal/devices/computer_scsi_host_6_scsi_device_lun0' 
> >>> (string)
> >>> 
> >>>   storage.removable = true  (bool)
> >>>   storage.removable.support_async_notification = false  (bool)
> >>>   storage.requires_eject = false  (bool)
> >>>   storage.vendor = 'Kindle'  (string)
> >>> 
> >>> Here is the umass device:
> >>> 
> >>> udi =
> >>> '/org/freedesktop/Hal/devices/usb_device_1949_4_B008A0A00527517D_if0'
> >>> 
> >>>   freebsd.driver = 'umass'  (string)
> >>>   freebsd.unit = 0  (0x0)  (int)
> >>>   info.bus = 'usb'  (string)
> >>>   info.parent =
> >>> 
> >>> '/org/freedesktop/Hal/devices/usb_device_1949_4_B008A0A00527517D' 
> >>> (string)
> >>> 
> >>>   info.product = 'Amazon Kindle'  (string)
> >>>   info.subsystem = 'usb'  (string)
> >>>   info.udi =
> >>> 
> >>> '/org/freedesktop/Hal/devices/usb_device_1949_4_B008A0A00527517D_if0' 
> >>> (string)
> >>> 
> >>>   info.vendor = 'Amazon'  (string)
> >>>   usb.bus_number = 2  (0x2)  (int)
> >>>   usb.can_wake_up = false  (bool)
> >>>   usb.configuration = 'Self-powered'  (string)
> >>>   usb.configuration_value = 1  (0x1)  (int)
> >>>   usb.device_class = 0  (0x0)  (int)
> >>>   usb.device_protocol = 0  (0x0)  (int)
> >>>   usb.device_revision_bcd = 256  (0x100)  (int)
> >>>   usb.device_subclass = 0  (0x0)  (int)
> >>>   usb.freebsd.devname = 'umass0'  (string)
> >>>   usb.interface.class = 8  (0x8)  (int)
> >>>   usb.interface.description = 'Mass Storage'  (string)
> >>>   usb.interface.number = 0  (0x0)  (int)
> >>>   usb.interface.protocol = 80  (0x50)  (int)
> >>>   usb.interface.subclass = 6  (0x6)  (int)
> >>>   usb.is_self_powered = true  (bool)
> >>>   usb.level_number = 1  (0x1)  (int)
> >>>   usb.max_power = 0  (0x0)  (int)
> >>>   usb.num_configurations = 1  (0x1)  (int)
> >>>   usb.num_interfaces = 1  (0x1)  (int)
> >>>   usb.num_ports = 0  (0x0)  (int)
> >>>   usb.port_number = 2  (0x2)  (int)
> >>>   usb.product = 'Amazon Kindle'  (string)
> >>>   usb.product_id = 4  (0x4)  (int)
> >>>   usb.serial = 'B008A0A00527517D'  (string)
> >>>   usb.speed = 480.0 (480) (double)
> >>>   usb.speed_bcd = 294912  (0x48000)  (int)
> >>>   usb.vendor = 'Amazon'  (string)
> >>>   usb.vendor_id = 6473  (0x1949)  (int)
> >>>   usb.version = 2.0 (2) (double)
> >>> 
> >>> What do you think?
> >>> Is this a FreeBSD HAL problem?


More information about the freebsd-gnome mailing list