I am new in C programming
Here i want to detect USB is inserted or not in Linux
I want to detect this things on my embedded linux device. which have customized linux.
So i want to detect the block of USB where i have to mount this block. like sda,sdb or sdc.
I want to o this thing in C programming for linux.
Here i have path for usb devices /sys/bus/usb/devices
i can see usb information is available is here /sys/bus/usb/devices/1-x
so i want to fetch the address of block where this usb is inserted like sda,sdb or sdc.
So now after fetching this address name i have to mount usb on particular path.
so can anybody please suggest me how can i detect usb is inserted or not if inserted than how can i know address of this
Set up a hotplug event handler: You will get a hotplug block event when a block device appears or goes away, which you can use to mount/umount and run your handler scripts and apps.