Sponsored Content
Top Forums UNIX for Advanced & Expert Users How to uniquely distinguish between two USB ports?? Post 302513983 by Corona688 on Thursday 14th of April 2011 12:45:56 PM
Old 04-14-2011
Is your system Linux? udev provides convenient symlinks for this on many systems:
Code:
# when plugged into one port
$ ls -l /dev/disk/by-path/ | grep usb
lrwxrwxrwx 1 root root  9 Apr 14 10:43 pci-0000:00:02.1-usb-0:2:1.0-scsi-0:0:0:0 -> ../../sdd
lrwxrwxrwx 1 root root 10 Apr 14 10:43 pci-0000:00:02.1-usb-0:2:1.0-scsi-0:0:0:0-part1 -> ../../sdd1
lrwxrwxrwx 1 root root 10 Apr 14 10:43 pci-0000:00:02.1-usb-0:2:1.0-scsi-0:0:0:0-part2 -> ../../sdd2
# when plugged into another port
$ ls -l /dev/disk/by-path/ | grep usb
lrwxrwxrwx 1 root root  9 Apr 14 10:46 pci-0000:00:04.1-usb-0:1:1.0-scsi-0:0:0:0 -> ../../sdd
lrwxrwxrwx 1 root root 10 Apr 14 10:46 pci-0000:00:04.1-usb-0:1:1.0-scsi-0:0:0:0-part1 -> ../../sdd1
lrwxrwxrwx 1 root root 10 Apr 14 10:46 pci-0000:00:04.1-usb-0:1:1.0-scsi-0:0:0:0-part2 -> ../../sdd2

If you check the udev rules that created these symlinks you can find out how udev gleans this information when creating them and make a rule that automounts for you perhaps.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

One Last Question about Core Files (distinguish) URGENT

now, what do you define as core files. there are some files outthere with the name perl.core, I-core.png, core.png I mean, are these classified as core files too??? i thought core files are simply files called "core". Please help me out this is urgent (2 Replies)
Discussion started by: TRUEST
2 Replies

2. Programming

how to find usb ports programmatically

I need to find out where a usb flash memory drive is mounted. I have used prtconf and iostat to find the information and then used popen to parse the information to find what i need. I am wondering if there are some generic functions such as ddi_ or usb_ that i can use to find such info. I would... (1 Reply)
Discussion started by: jtcoelho
1 Replies

3. AIX

distinguish the extension of a file

Hello, In a script shell, I have a variable containing the name of a file and I would like to distinguish the name from the extention of the file. For example, the file 'myfile.txt' is in a variable called $VAR. How can I obtain 2 variables, one with 'myfile' and the other with 'txt' ? Thank you (2 Replies)
Discussion started by: tbeghain
2 Replies

4. UNIX for Dummies Questions & Answers

How to Sort Records Uniquely?

I have a file containing many records separated by a % that I would like to sort uniquely (and if possible with a count of dupes) while maintaining the integrity of each record. File looks like this: % srcip: 5.6.7.8 srcburb: internal dstip: 1.2.3.4 dstport: 2000 dstburb: external... (12 Replies)
Discussion started by: earnstaf
12 Replies

5. UNIX for Dummies Questions & Answers

USB Ports

I want to map out specific USB ports. For example if there are 7 ports on a USB hub I want to be able to identify port #2 and send a file there. How does UNIX see these ports? (1 Reply)
Discussion started by: eggfoot
1 Replies

6. HP-UX

how to distinguish different files while ftp?

how to distinguish different files and choose a mode while ftp?means which modes ascii or binary for zip(.gz) ,.txt,.sh,.dat and executable as well as movie files. (1 Reply)
Discussion started by: megh
1 Replies

7. Programming

what is the distinguish between gmake and make?

I am working on solaris 9. and use gmake to compile and linke c/c++ program. anybody can tell me the distinguish between gmake and make? :confused: (10 Replies)
Discussion started by: robin.zhu
10 Replies

8. UNIX for Advanced & Expert Users

how to distinguish entry/exit of a syscall when using ptrace?

Hi all, I am using ptrace to keep track of clone syscalls in a program. However, I found that the traced syscall cant be paired. for example, there are some syscalls that have entry, but without exit showing up in the traced sequences. So, is there anyway to distinguish the entry and exit of a... (0 Replies)
Discussion started by: tristartom
0 Replies

9. Linux

nix User Access Restrictions to Network, USB ports, PCMCIA, CDROM

How to create a user account on a Linux desktop machine with restrictions on connecting to the LAN, WAN, PCMCIA ports, Firewire, CDROM and generally any user controllable output options? I have the task to set up a machine for users working with sensitive data that should not be leaving the... (1 Reply)
Discussion started by: netfreighter
1 Replies

10. SCO

Distinguish between file systems

Hello, is there any command in SCO unix by which I can check if the file system is HTFS or DTFS? Thanks (1 Reply)
Discussion started by: Mick
1 Replies
EHCI(4) 						   BSD Kernel Interfaces Manual 						   EHCI(4)

NAME
ehci -- USB Enhanced Host Controller driver SYNOPSIS
ehci* at cardbus? function ? ehci* at pci? dev ? function ? usb* at ehci? DESCRIPTION
The ehci driver provides support for the USB Enhanced Host Controller Interface, which is used by USB 2.0 controllers. EHCI controllers are peculiar in that they can only handle the USB 2.0 protocol. This means that they normally have one or more companion controllers (i.e., ohci(4) or uhci(4)) handling USB 1.x devices. Consequently each USB connector is electrically connected to two USB con- trollers. The handling of this is totally automatic, but can be noticed since USB 1.x and USB 2.0 devices plugged in to the same connector appear to connect to different USB busses. SEE ALSO
cardbus(4), ohci(4), pci(4), uhci(4), usb(4) HISTORY
The ehci driver appeared in NetBSD 1.6. BUGS
The support for hubs that are connected with high speed upstream and low or full speed downstream (i.e., for transaction translators) is lim- ited. BSD
Aug 10, 2008 BSD
All times are GMT -4. The time now is 08:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy