Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

here is my situation, I am writing a c program in linux and in the program I am mounting 2 usb devices attached to 2 specific ports in the computer. (eg : I have to mount the usb attached to the left port in to /mnt/left and the right port to /mnt/right) and the attachment order of those devices may differ (eg: left port usb may or may not be attached before the right.) In this case what should i do?

share|improve this question
add comment

1 Answer

Again we meet.

Here you have your USB ports. Check which is for left and which is for right -> /sys/bus/usb/devices. When you attach device to usb port, you will get a dmesg message about to which port it is attached. Something like this:

input: Logitech USB Receiver as /devices/pci0000:00/0000:00:1d.2/usb4/4-1/4-1:1.0/input/input

You just need to pair your usb device with the port.

share|improve this answer
    
Hi tdi, since I am a newb to linux, Can you please elaborate your answer? Actually I want to mount any usb device attached to left port (say port1) to one location and the right to another location meaning that the left port usb device and the right port device can change with time. (I may mount different usb devices to left/right port with time.) and this has to be written in a c program. (the program runs every time a usb is attached.) thank you. –  gosk Mar 27 '11 at 17:45
    
Hi tdi, I think I found the answer. It has to be done using 'udev' rules. thank you for your interest. –  gosk Mar 28 '11 at 7:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.