Yeah, but if Android doesn't use USB except to act as a USB device externally and do things like talk to the SD card slot internally, then expecting an intent to be sent when any USB device is plugged in might be a bit much.
A general Linux approach, like listening for the DeviceAdded signal from D-Bus, rather than something Android specific might be needed. Although that "on device-added" trigger under the Android Init Language heading in the platform dev guide looks interesting: http://pdk.android.com/online-pdk/guide/bring_up.html#androidInitLanguage It might be better to ask in the android-platform, android-porting, or android-ndk groups. USB doesn't seem to be something the SDK currently covers. On Dec 12, 12:29 am, lidemin <[email protected]> wrote: > Thanks for giving your point of view ,and i had seen this issue > before i tested, > > however the USB device which i pluged in ( i have ported the Android- > x86 to my develop-board) actually worked well except it couldn't be > mounted automatically. After i mounted the USB manually to the "/ > sdcard" i could read data from the USB ( playback the music in it . > etc). So i think it could act as a USB host througn my test > result.Although i don't know more details about the reason . > > my Android's version is 1.5. I think that it uses the Linux kernel > so if the Linux kernel could surport the USB we could say Android also > surport the USB . Am i right? I am a freshman of the LINUX and Android > so all these are my surmises. > > Besides i checked the source code of the Android . And i found there > are some files in the kernel like "AutoMount.c" and "Mount.c" . Looked > through these file I guess Android could get the message that a new > USB device plug-in from the process "Mountd". And after that it could > try to mount this device to an appointed path. > > In my test , after i plug-in the USB device i surely found that the > process "Mountd" created a new device in "/dev/block/sdc" and after > that this process tried mount the device to "/sdcard" .All these > information the system printed on the CLI screen as LOG.But that is > all, no sucess ,no failure ,and no more information about the > process . I checked but the device was not mounted successfully. So i > tried to mount the device by myself and suceed. > > the problem puzzled me and made me crazy.Thanks for helping me. > > PS: the souce code files I metioned just now(http:// > android.git.kernel.org/?p=platform/system/ > core.git;a=tree;f=mountd;h=529eeda616338dd8d5c7dfc1cb20475ccba97053;hb=77d0c65b950570edd5241a8f2ebecfc3acbc5135) > disappeared in the latest project (http://android.git.kernel.org/? > p=platform/system/core.git;a=tree) . I don't know when the codes were > dropped and why. > > On 12月12日, 上午11时26分, Lance Nanek <[email protected]> wrote: > > > It's interesting that it tried to mount a USB device that was plugged > > in. I thought Android would only act as a USB device, not a USB host, > > as per this issue:http://code.google.com/p/android/issues/detail?id=738 > > > Although there is a link on that page to some people using USB host > > mode on Android that's been ported to Openmoko phones. > > > On Dec 11, 9:16 pm, lidemin <[email protected]> wrote: > > > > thanks a lot for this message, and i followed this to test again. > > > > but after i inserted the SD card the system still had no message to > > > send out. > > > > and again i checked the info about the LOG in the CLI, found that the > > > "mountd" process had found the device ( like when i inserted the USB > > > device ) and tried to mount this device to "/sdcard" .However the LOG > > > had no more message about the mount result , and i didn't know > > > whether there is an error or not. I only had to check the "sdcard" > > > folder but found nothing in it. And i tried to mount this device to > > > this path manually and succeed. But still had no intent > > > (android.intent.action.MEDIA_MOUNTED ) to send out by system . > > > > did anyone get it( the system message about detecting the external > > > device ) on the mobile or the other devices? > > > > Or should i send this question to android-porting? And thank you all. > > > > On 12月12日, 上午4时29分, Paul Turchenko <[email protected]> wrote: > > > > > Only thing I can state is thatandroid.intent.action.MEDIA_MOUNTED is > > > > for SD card being inserted... My guess is that forUSBdevice > > > > discovery you'll have to dig something more low-level. > > > > > On Dec 11, 8:45 am, lidemin <[email protected]> wrote: > > > > > > hi all, > > > > > now i have ported theAndroidto a x86 platform. > > > > > And i want todetecttheUSBplug-in.But follow the information about > > > > > theandroid.intent.action.MEDIA_MOUNTED > > > > > in the SDK's DOC, i can't receive the event of theUSB'splug-in. > > > > > > i have checked my code and it can receive the other event ( ps:intent > > > > > action) . > > > > > > Besides, in the CLI, i could mount theUSBdeviceto /sdcard but it > > > > > couldn't mount automatically. > > > > > > have seen some source code about the mount and mountlistener and it > > > > > should be effective. > > > > > > who can tell me what the problem is? and my SDK's version is 1.5.- > > > > > 隐藏被引用文字 - > > > > > - 显示引用的文字 -- 隐藏被引用文字 - > > > - 显示引用的文字 - -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

