2010-04-16 02:11:53     USB hotplug Issue

Document created by Aaronwu Employee on Aug 21, 2013
Version 1Show Document
  • View in full screen mode

2010-04-16 02:11:53     USB hotplug Issue

John Peter (INDIA)

Message: 88490   

 

I have enabled hotplug in my kernel.

 

I have the following lines in my /vendors/AnalogDevices/common/rc script:

 

echo "USB Removed" > /tmp/USBInserted.txt

 

echo /bin/mdev >/proc/sys/kernel/hotplug

 

 

I have put the following in my hotplug script file /romfs/bin/hotplug.sh

 

/******************HOT Plug Script ****************************/

 

#!/bin/sh

 

case "$ACTION" in

        add|"")

                        echo "USB Attached" > /tmp/USBInserted.txt

                ;;

        remove)

                        echo "USB Removed" > /tmp/USBInserted.txt

                ;;

esac

 

/*****************************************************************/

 

After booting uImage with the USB attached, if I check the file /tmp/USBInserted.txt , it is always contains "USB Removed"

 

 

 

Can any one pls clarify where I have done the mistakes?

 

 

 

Thanks

 

Peter.

 

 

 

 

 

 

 

QuoteReplyEditDelete

 

 

2010-04-16 02:46:12     Re: USB hotplug Issue

Mike Frysinger (UNITED STATES)

Message: 88491   

 

please read the documentation:

  docs.blackfin.uclinux.org/doku.php?id=linux-kernel:hotplug

  docs.blackfin.uclinux.org/doku.php?id=uclinux-dist:mdev

QuoteReplyEditDelete

 

 

2010-04-16 03:27:44     Re: USB hotplug Issue

Wolfgang Muees (GERMANY)

Message: 88505   

 

Please post the contents of your /etc/mdev.conf file.

TranslateQuoteReplyEditDelete

 

 

2010-04-16 04:25:11     Re: USB hotplug Issue

John Peter (INDIA)

Message: 88508   

 

Hai,

 

Please find below the content of /etc/mdev.conf

 

 

 

# see user/busybox/busybox-*/docs/mdev.txt

 

event.* 0:0 0664 >input/

 

input.* 0:0 0664 >input/

 

mice.* 0:0 0664 >input/

 

mouse.* 0:0 0664 >input/

 

controlC[0-9] 0:0 0664 >snd/

 

pcmC[0-9]D[0-9][cp] 0:0 0664 >snd/

 

timer 0:0 0664 >snd/

 

seq 0:0 0664 >snd/

 

sd[a-z][0-15]* 0:0 0664 */bin/hotplug-usb

 

 

 

Thanks

 

Peter

QuoteReplyEditDelete

 

 

2010-04-16 04:45:23     Re: USB hotplug Issue

Mike Frysinger (UNITED STATES)

Message: 88513   

 

"/bin/hotplug-usb" is obviously not the same thing as "/bin/hotplug.sh"

QuoteReplyEditDelete

 

 

2010-04-16 06:16:27     Re: USB hotplug Issue

John Peter (INDIA)

Message: 88517   

 

Hai,

 

I cant change the hotplug-usb to hotplug in /etc/mdev.conf

 

Even if I change hotplug-usb to  hotplug and compile it remains unaltered. Also I cant find the file /bin/hotplug or /bin/hotplug-usb.(I have enabled Device Hotplug in the kernel).

 

Can you please clarify this?

 

thanks

Peter

QuoteReplyEditDelete

 

 

2010-04-16 06:37:05     Re: USB hotplug Issue

Mike Frysinger (UNITED STATES)

Message: 88519   

 

these are all files up to you to create.  there are no configuration settings that control these.

QuoteReplyEditDelete

 

 

2010-04-21 05:51:14     Re: USB hotplug Issue

John Peter (INDIA)

Message: 88721   

 

Hai,

I got hotplug enabled for my USB. Now when ever I insert and remove the USB to my custom board, I got the mesage as

 

hotplug: usb removed

hotplug: usb inserted , from the hotplug script.

 

The following is my code in /romfs/bin/hotplug

 

#!/bin/sh

 

output=/dev/ttyBF1

 

 

if [ "$ACTION" = add ]; then

echo "hotplug: usb inserted" >> $output

echo 1 > /tmp/USBInserted.txt

fi

 

if [ "$ACTION" = remove ]; then

echo "hotplug: usb removed" >> $output

echo 0 > /tmp/USBInserted.txt

fi

 

I am checking in my application for the file /tmp/USBInserted.txt for the USB inserted or not.

 

Now I removed the USB stick from my board and attached it once again. I got the following message:

 

 

hotplug: usb removed

hotplug: usb inserted.

 

But I cant get the rest of the application execution after removal. Can any one please clarify that whether I need to do anything in the hotplug or in my application?

 

Thanks,

Peter

QuoteReplyEditDelete

 

 

2010-04-21 05:57:31     Re: USB hotplug Issue

Mike Frysinger (UNITED STATES)

Message: 88722   

 

i have no idea what "cant get the rest of the application execution after removal" means

 

instead of polling random files, it'd make more sense to use standard methods such as sending a signal or passing messages via sysvipc

QuoteReplyEditDelete

 

 

2010-04-22 06:27:37     Re: USB hotplug Issue

John Peter (INDIA)

Message: 88762   

 

Hai,

Thanks for your support. I had resolved that issue. I have two more issues to be resolved.

 

Issue 1:

 

I am having more than one partion in my USB Hard disc. I need to extract the name of each partion  using blkid. Can any one clarify how to extract the Volume/Label name from cat proc/partitions or is there any other way to do this ?

 

Issue 2:

 

In USB Hard disc having more than one partion, how to check whether the given partion is mountable or not? I need only the list of mountable partitions. Please clarify the same.

 

 

 

 

Thanks,

Peter.

QuoteReplyEditDelete

 

 

2010-04-22 10:21:37     Re: USB hotplug Issue

Mike Frysinger (UNITED STATES)

Message: 88770   

 

the kernel has no real business with this sort of metadata.  this is for userspace (i.e. you) to handle.  it merely checks the partition table at the start of the disk and that is all.

 

the blkid library from the util-linux package provides functions to do all of this (look up volume/uuid/fstype/etc...) that you can link into your app.

QuoteReplyEditDelete

 

 

2010-04-27 04:56:43     Re: USB hotplug Issue

John Peter (INDIA)

Message: 88955   

 

Hai,

I have been trying to extract the partion name of USB Hard disc. I tried using command like libblkid and blkid. But I cant get the name.  I dont know where to look for volume/uuid/fstype/etc.

 

Can any one suggest me any ways to extract the volume name/label? Whether I need to include any header files or enable in my kernel?

 

Thanks

Peter.

QuoteReplyEditDelete

 

 

2010-04-27 05:35:39     Re: USB hotplug Issue

Mike Frysinger (UNITED STATES)

Message: 88956   

 

read the blkid documentation.  it provides functions to look up all that information for a given partition.

QuoteReplyEditDelete

Attachments

    Outcomes