# udev needs 'udevadm --trigger' to see phone sdcard

## mjbjr

A couple of months ago, I rebuilt my gentoo system:

# uname -a

Linux localhost 3.1.0-gentoo-r1 #1 SMP Mon Nov 7 18:42:35 PST 2011 x86_64 Intel(R) Core(TM)2 CPU 6700 @ 2.66GHz GenuineIntel GNU/Linux

With this new build, when I plug in my NexusOne phone via usb, gentoo sees the phone:

Jan  4 22:04:02 localhost kernel: [1229583.408323] ehci_hcd 0000:00:1d.7: port 5 high speed

Jan  4 22:04:02 localhost kernel: [1229583.408329] ehci_hcd 0000:00:1d.7: GetStatus port:5 status 001005 0  ACK POWER sig=se0 PE CONNECT

Jan  4 22:04:02 localhost kernel: [1229583.459037] usb 1-5: new high speed USB device number 24 using ehci_hcd

Jan  4 22:04:02 localhost kernel: [1229583.511325] ehci_hcd 0000:00:1d.7: port 5 high speed

Jan  4 22:04:02 localhost kernel: [1229583.511330] ehci_hcd 0000:00:1d.7: GetStatus port:5 status 001005 0  ACK POWER sig=se0 PE CONNECT

Jan  4 22:04:02 localhost kernel: [1229583.581085] usb 1-5: default language 0x0409

Jan  4 22:04:02 localhost kernel: [1229583.587084] usb 1-5: udev 24, busnum 1, minor = 23

Jan  4 22:04:02 localhost kernel: [1229583.587088] usb 1-5: New USB device found, idVendor=18d1, idProduct=4e12

Jan  4 22:04:02 localhost kernel: [1229583.587092] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3

Jan  4 22:04:02 localhost kernel: [1229583.587096] usb 1-5: Product: Nexus One

Jan  4 22:04:02 localhost kernel: [1229583.587099] usb 1-5: Manufacturer: Google, Inc.

Jan  4 22:04:02 localhost kernel: [1229583.587102] usb 1-5: SerialNumber: HT08ZP803013

Jan  4 22:04:02 localhost kernel: [1229583.587214] usb 1-5: usb_probe_device

Jan  4 22:04:02 localhost kernel: [1229583.587219] usb 1-5: configuration #1 chosen from 1 choice

Jan  4 22:04:02 localhost kernel: [1229583.588091] usb 1-5: adding 1-5:1.0 (config #1, interface 0)

Jan  4 22:04:02 localhost kernel: [1229583.590120] usb-storage 1-5:1.0: usb_probe_interface

Jan  4 22:04:02 localhost kernel: [1229583.590128] usb-storage 1-5:1.0: usb_probe_interface - got id

Jan  4 22:04:02 localhost kernel: [1229583.590133] usb-storage: USB Mass Storage device detected

Jan  4 22:04:02 localhost kernel: [1229583.590180] usb-storage: -- associate_dev

Jan  4 22:04:02 localhost kernel: [1229583.590184] usb-storage: Vendor: 0x18d1, Product: 0x4e12, Revision: 0x0227

Jan  4 22:04:02 localhost kernel: [1229583.590187] usb-storage: Interface Subclass: 0x06, Protocol: 0x50

Jan  4 22:04:02 localhost kernel: [1229583.590192] usb-storage: Transport: Bulk

Jan  4 22:04:02 localhost kernel: [1229583.590194] usb-storage: Protocol: Transparent SCSI

Jan  4 22:04:02 localhost kernel: [1229583.590227] scsi29 : usb-storage 1-5:1.0

Jan  4 22:04:02 localhost kernel: [1229583.590230] usb-storage: *** thread sleeping.

Jan  4 22:04:02 localhost kernel: [1229583.590343] usb-storage 1-5:1.0: device found

Jan  4 22:04:02 localhost kernel: [1229583.590345] usb-storage 1-5:1.0: waiting for device to settle before scanning

Jan  4 22:04:02 localhost kernel: [1229583.590363] usb 1-5: adding 1-5:1.1 (config #1, interface 1)

Jan  4 22:04:03 localhost kernel: [1229584.590036] usb-storage: usb_stor_control_msg: rq=fe rqtype=a1 value=0000 index=00 len=1

Jan  4 22:04:03 localhost kernel: [1229584.590218] usb-storage: GetMaxLUN command result is -32, data is 0

Jan  4 22:04:03 localhost kernel: [1229584.590283] usb-storage: queuecommand_lck called

Jan  4 22:04:03 localhost kernel: [1229584.590289] usb-storage: *** thread awakened.

Jan  4 22:04:03 localhost kernel: [1229584.590292] usb-storage: Command INQUIRY (6 bytes)

Jan  4 22:04:03 localhost kernel: [1229584.590293] usb-storage:  12 00 00 00 24 00

Jan  4 22:04:03 localhost kernel: [1229584.590299] usb-storage: Bulk Command S 0x43425355 T 0x1 L 36 F 128 Trg 0 LUN 0 CL 6

Jan  4 22:04:03 localhost kernel: [1229584.590301] usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes

Jan  4 22:04:03 localhost kernel: [1229584.590457] usb-storage: Status code 0; transferred 31/31

Jan  4 22:04:03 localhost kernel: [1229584.590460] usb-storage: -- transfer complete

Jan  4 22:04:03 localhost kernel: [1229584.590462] usb-storage: Bulk command transfer result=0

Jan  4 22:04:03 localhost kernel: [1229584.590466] usb-storage: usb_stor_bulk_transfer_sglist: xfer 36 bytes, 1 entries

Jan  4 22:04:03 localhost kernel: [1229584.591083] usb-storage: Status code 0; transferred 36/36

Jan  4 22:04:03 localhost kernel: [1229584.591088] usb-storage: -- transfer complete

Jan  4 22:04:03 localhost kernel: [1229584.591093] usb-storage: Bulk data transfer result 0x0

Jan  4 22:04:03 localhost kernel: [1229584.591098] usb-storage: Attempting to get CSW...

Jan  4 22:04:03 localhost kernel: [1229584.591104] usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes

Jan  4 22:04:03 localhost kernel: [1229584.592082] usb-storage: Status code 0; transferred 13/13

Jan  4 22:04:03 localhost kernel: [1229584.592085] usb-storage: -- transfer complete

Jan  4 22:04:03 localhost kernel: [1229584.592087] usb-storage: Bulk status result = 0

Jan  4 22:04:03 localhost kernel: [1229584.592090] usb-storage: Bulk Status S 0x53425355 T 0x1 R 0 Stat 0x0

Jan  4 22:04:03 localhost kernel: [1229584.592094] usb-storage: scsi cmd done, result=0x0

Jan  4 22:04:03 localhost kernel: [1229584.592099] usb-storage: *** thread sleeping.

Jan  4 22:04:03 localhost kernel: [1229584.592138] scsi 29:0:0:0: Direct-Access     Google,  Inc.Nexus One         PQ: 0 ANSI: 2

Jan  4 22:04:03 localhost kernel: [1229584.592374] sd 29:0:0:0: Attached scsi generic sg6 type 0

Jan  4 22:04:03 localhost kernel: [1229584.592430] usb-storage: queuecommand_lck called

Jan  4 22:04:03 localhost kernel: [1229584.592540] usb-storage: *** thread awakened.

and the phone shows up in /dev:

# ls -l /dev/nex*

lrwxrwxrwx 1 root root  3 Jan  4 22:04 /dev/nexus -> sdf

lrwxrwxrwx 1 root root 12 Jan  4 22:04 /dev/nexus0 -> bsg/29:0:0:0

lrwxrwxrwx 1 root root 15 Jan  4 22:04 /dev/nexus5 -> bus/usb/001/024

lrwxrwxrwx 1 root root  3 Jan  4 22:04 /dev/nexus6 -> sg6

But, at this point, I still haven't pressed the button on the phone to umount the sdcard from the phone to make it

available to mount to my gentoo box. When I do press the button on the phone to umount the sdcard the gentoo

box doesn't see that, i.e., there's no new '/dev/nexus1' device, and there are no new changes to '/var/log/messages'.

If I then do a 'udevadm --trigger',  my udev rule for the phone (same rule for a year or more) works and the correct

device shows up:

# ls -l /dev/nex*

lrwxrwxrwx 1 root root  3 Jan  4 22:34 /dev/nexus -> sdf

lrwxrwxrwx 1 root root 12 Jan  4 22:34 /dev/nexus0 -> bsg/29:0:0:0

lrwxrwxrwx 1 root root  4 Jan  4 22:34 /dev/nexus1 -> sdf1

lrwxrwxrwx 1 root root 15 Jan  4 22:34 /dev/nexus5 -> bus/usb/001/024

lrwxrwxrwx 1 root root  3 Jan  4 22:34 /dev/nexus6 -> sg6

In the past, I haven't had to use 'udevadm --trigger' to get the phone's now available sdcard to be seen.

I've upgraded udev to 'sys-fs/udev-171-r5', but still no joy.

Here's my rule:

# 20100329 - this works

SUBSYSTEMS=="usb", ATTRS{manufacturer}=="Google, Inc.", ATTRS{product}=="Nexus One", ATTRS{serial}=="xxxxxxxxxxxxx", SYMLINK+="nexus%n", MODE="0666", OWNER="mjbjr"

Here's my 'emerge --info'

Portage 2.1.10.44 (default/linux/amd64/10.0, gcc-4.5.3, glibc-2.13-r4, 3.1.0-gentoo-r1 x86_64)

=================================================================

System uname: Linux-3.1.0-gentoo-r1-x86_64-Intel-R-_Core-TM-2_CPU_6700_@_2.66GHz-with-gentoo-2.1

Timestamp of tree: Thu, 05 Jan 2012 06:15:01 +0000

app-shells/bash:          4.2_p10

dev-lang/python:          2.7.2-r3, 3.2.2

dev-util/cmake:           2.8.6-r3

dev-util/pkgconfig:       0.26

sys-apps/baselayout:      2.1

sys-apps/openrc:          0.9.4

sys-apps/sandbox:         2.5

sys-devel/autoconf:       2.13, 2.68

sys-devel/automake:       1.11.1-r1

sys-devel/binutils:       2.22

sys-devel/gcc:            4.5.3-r1

sys-devel/gcc-config:     1.5-r2

sys-devel/libtool:        2.4.2

sys-devel/make:           3.82-r3

sys-kernel/linux-headers: 2.6.39 (virtual/os-headers)

sys-libs/glibc:           2.13-r4

Repositories: gentoo

ACCEPT_KEYWORDS="amd64 ~amd64"

ACCEPT_LICENSE="* -@EULA"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-march=core2 -O2 -pipe"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-march=core2 -O2 -pipe"

DISTDIR="/usr/portage/distfiles"

FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"

FFLAGS=""

GENTOO_MIRRORS="ftp://mirror.mcs.anl.gov/pub/gentoo/  ftp://ftp.free.fr/mirrors/ftp.gentoo.org/"

LANG="en_US.utf8"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

LINGUAS="en"

MAKEOPTS="-j3"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY=""

SYNC="rsync://rsync.us.gentoo.org/gentoo-portage"

USE="X acl alsa amd64 apng berkdb bzip2 cairo cli consolekit cracklib crypt css cups cxx demosaic dri ffmpeg fortran gdbm gdu gpm gtk gudev iconv icu ipv6 jpe jpeg jpg minizip mmx modules mp3 mudflap multilib ncurses nls nptl nptlonly ogg openmp pam pcre png policykit ppds pppd python readline ruby session sndfile sse sse2 ssl sysfs tcpd tiff udev ufraw unicode v4l wav xmp xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev mouse keyboard" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

Any ideas?

Thanks

----------

## devsk

its disheartening to find a thread which describes the problem you are having so much exactly and then not finding the solution. Is no one using custom udev rules? How are they getting triggered with plug and play for you?

----------

## greyspoke

I had this kind of problem, then I discovered sys-apps/uam and it seemed to do roughly what I wanted (and dealt with cds as well), so I ditched my custom rules. 

My prob wasn't the same though, my Android phone took time to make the partition on the sd card available, I had to write a rule that waited and then triggered the device.

Maybe the prob had something to do with HAL removal?   Uam uses kernel polling to find out about removable drives.

----------

## PaulBredbury

I would suggest trying udev 175, with Ubuntu's patches. Udev 175 is also in Debian's "testing".

I dunno why Gentoo's udev skips so many versions.

Edit: There's also a udev fork to try.

----------

