Look-up USB mounting point


 
Thread Tools Search this Thread
Top Forums Programming Look-up USB mounting point
# 1  
Old 04-15-2013
Look-up USB mounting point

Hi all,


I'm developing a short program to look-up for all devices connected to the computer. Using udev and libusb libraries I achieved some progress but I can not find the way to find the mount point.

For instance, given a device that I can retrieve using libusb, I would like to know where it is mounted so I can pass this information to another function to connect to the port.

Thanks in advance,

Carles.
# 2  
Old 04-15-2013
As USB is a hot pluggable _port_ then it is not possible to code for it as a permanent event.

Example...

/dev/ttyUSB0 exists and is up and running and you are in connection with an external device. Some clown comes along and trips over the cable pulling it out whilst in mid flight.

What does your detection code then do?

It says that the _port_ is in use, one of a possible 127 USB devices, but in reality connectivity has been broken...

You can ONLY use your idea IF and only IF you can guarantee no external event to create a _crash_.

Also things occur when you plug your item(s) in AFTER running a language like say Python running from a shell...

It probably will NOT be seen by Python although the shell might see it...

So be very careful before creating auto-detect scripts on dynamic _port_(s)...

Bazza...
# 3  
Old 04-15-2013
Hi Wisecracker,

The thing is as follows:


My program starts and checks where the devices have been mapped.
I know the devices have been plugged but what I don't know is what name do they get.
Using the libusb library I can confirm they are plugged but I still don't know whether they are /dev/ttyUSB0 or /dev/ttyUSB1 or ...

It must be possible to retrieve what is the mount point from C++.

Thanks again,

Carles.
# 4  
Old 04-15-2013
Again be very careful.

/dev/ttyACM0 is also a USB device...

Apple OSX, (at least from 10.7.5), has its own brand of naming USB devices...

I am assuming you are using a Linux flavour...

You could try before any plug(g)able devices are attached:-

Code:
ls /dev > /path/to/devcies.txt

Plug the USB items in, allow a couple of seconds to settle, then:-
Code:
ls /dev > /path/to/newdevices.txt

Then compare the two files...

Crude I know, but a simple way...

As I said before you can ONLY do this IF and only IF you can guarantee _permanent_ connectivity...
# 5  
Old 04-15-2013
mount will tell you mountpoints.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

What happen if we delete the parent mounting point

Hi Friends I Have a question about mounting point This is a output of df -g I wanted to delete the first FS /dev/lvdb2inst1 which is mounted on /db2/db2ins1 http://i43.tinypic.com/35in6ts.jpg Here my question is, if we delete the first FS , are other two FS are unaccessble as all 3 ... (1 Reply)
Discussion started by: atul9806
1 Replies

2. Solaris

Mounting USB HD

I am very new to Solaris. The machine I am working with is running Solaris 10. I have a 1.5 TB hard drive plugged into a USB dock plugged into the Solaris machine. I ran 'cfgadm -al' and can see that the usb0/1 is usb-storage that was not there before. How do i mount this drive and format... (3 Replies)
Discussion started by: mcdef
3 Replies

3. BSD

Mounting a USB stick in FreeBSD

When mounting a USB stick or pen drive on a FreeBSD machine I always issue the following command: mount -t msdosfs /dev/da0s1 /mnt Something I have always wondered is what the option msdosfs stands for and more importantly, why it is necessary. (7 Replies)
Discussion started by: figaro
7 Replies

4. UNIX for Dummies Questions & Answers

Need help with mounting my USB

My previous post seems to be erased and I didn't get any help. I'm logged as root now but no mounting command seems to work, I've tried: Mount -t vfat /dev/sdc1 /mnt/USB Changing "sdc1" for hda1-7, and sdc1-7, and still nothing. Sometimes i get: "special device not found" and others "device... (4 Replies)
Discussion started by: Dax01
4 Replies

5. Solaris

mounting usb drive

hi, first of all, i would really like to know how to find out where my usb is in the system. if i "cd to /dev/usb i have a hub0 to hub4 and hid0 -- hid5 .. how do i know where my usb is? and i guess once i find out which one my usb is at, i can do something like "mount /dev/usb/xxx /tmp" ... (5 Replies)
Discussion started by: k2k
5 Replies

6. UNIX for Advanced & Expert Users

Mounting a USB device with a persistent name

When I attach a USB storage device to my Solaris server, the mount point is coming up as /rmdisk/unnamed_rmdisk Is there anyway I can have this device come up as a mounted device with a predetermined mount name eg /morespace rather than unnamed_rmdisk ? (2 Replies)
Discussion started by: jimthompson
2 Replies

7. UNIX and Linux Applications

Mounting a USB device with a predetermined name

When I attach a USB storage device to my Solaris server, the mount point is coming up as /rmdisk/unnamed_rmdisk Is there anyway I can have this device come up as a mounted device with a predetermined mount name eg /morespace rather than unnamed_rmdisk ? (0 Replies)
Discussion started by: jimthompson
0 Replies

8. Linux

mounting usb device

Hi Folks, I want to know how to mount usb device (cd,dvd etc) in linux, Regards, Manoj (4 Replies)
Discussion started by: manoj.solaris
4 Replies

9. UNIX for Advanced & Expert Users

mounting USB

Hi I was trying to mount my USB flashdrive on solaris 10 and I am getting the message saying that (I have already gone through the previous blogs in the forum) mount: Block device required. I have tried most of the possible ways. #rmformat(gives me the necessary information about my flash... (1 Reply)
Discussion started by: akhil1460
1 Replies
Login or Register to Ask a Question