Quantcast

how can I get usb port number?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

how can I get usb port number?

Bryan.Richmond
I'm trying to figure out a way to find out which usb port a device is connected to.  I have mulitiple of the same type of FT2232H chips hooked up.  
libusb has this command libusb_get_port_numbers. but it takes a libusb_device as an argument.

I tried to use libusb_get_device((&ftdic)->usb_dev), but this gave me a segfault.

Any help would be extremely appreciated. 


Bryan T. Richmond
Software Engineer
Environmental Sensors

INFICON, Inc
2 Technology Place
East Syracuse, NY 13057-9714

Phone: (315) 434-2559
Fax:      (315) 437-3803

E-Mail: [hidden email]
Web: www.INFICON.com

**********************************************************************
NOTICE: - This message including any attachments is intended only for the use of the designated recipient(s) named above and may contain confidential information protected by law.  If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or the taking of any action in reliance on the contents of this information is strictly prohibited.  If you have received this transmission in error, please notify the sender immediately by e-mail and delete the original message including any attachments.
***********************************************************************
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how can I get usb port number?

E.S. Rosenberg
I don't know if you can get the port number easily (or if it will be meaningful), but in a project I worked on we used the chips' serial number to differentiate between multiple chips present.

You can find the code here:
https://github.com/OpenLightingProject/ola/blob/master/plugins/ftdidmx/FtdiWidget.cpp

We used ftdi_usb_get_strings() - see line 143.

HTH,
Eli

2015-08-31 17:58 GMT+03:00 <[hidden email]>:
I'm trying to figure out a way to find out which usb port a device is connected to.  I have mulitiple of the same type of FT2232H chips hooked up.  
libusb has this command libusb_get_port_numbers. but it takes a libusb_device as an argument.

I tried to use libusb_get_device((&ftdic)->usb_dev), but this gave me a segfault.

Any help would be extremely appreciated. 


Bryan T. Richmond
Software Engineer
Environmental Sensors

INFICON, Inc
2 Technology Place
East Syracuse, NY 13057-9714

Phone: <a href="tel:%28315%29%20434-2559" value="+13154342559" target="_blank">(315) 434-2559
Fax:      <a href="tel:%28315%29%20437-3803" value="+13154373803" target="_blank">(315) 437-3803

E-Mail: [hidden email]
Web: www.INFICON.com

**********************************************************************
NOTICE: - This message including any attachments is intended only for the use of the designated recipient(s) named above and may contain confidential information protected by law.  If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or the taking of any action in reliance on the contents of this information is strictly prohibited.  If you have received this transmission in error, please notify the sender immediately by e-mail and delete the original message including any attachments.
***********************************************************************



libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how can I get usb port number?

Nathael Pajani
Hi all

I made a kernel patch to get static usb-serial numbering according to physical connection
port for Alcatel-lucent, because they needed an way to identify which of the (up to) 64
devices was related to which tty, without config of rules or other identification process
of the devices.

I never had time to commit the code to the kernel though I had their acknowledgment for
this (and it is GPL code anyway :), but I can make it available.

You will find in the patches how to identify a specific USB port and how to change the USB
numbering shcheme (on simply add a message in syslog which allows easy identification of
which port holds which device.

Let me know if you are interrested.

As I'm working as a freelance, if you need support to integrate it in your specific
application I can propose my services for this.

Thanks.
+++


On 31/08/2015 20:52, E.S. Rosenberg wrote:

> I don't know if you can get the port number easily (or if it will be meaningful), but in a
> project I worked on we used the chips' serial number to differentiate between multiple
> chips present.
>
> You can find the code here:
> https://github.com/OpenLightingProject/ola/blob/master/plugins/ftdidmx/FtdiWidget.cpp
>
> We used ftdi_usb_get_strings() - see line 143.
>
> HTH,
> Eli
>
> 2015-08-31 17:58 GMT+03:00 <[hidden email] <mailto:[hidden email]>>:
>
>     I'm trying to figure out a way to find out which usb port a device is connected to.  I
>     have mulitiple of the same type of FT2232H chips hooked up.  
>     libusb has this command libusb_get_port_numbers. but it takes a libusb_device as an
>     argument.
>
>     I tried to use libusb_get_device((&ftdic)->usb_dev), but this gave me a segfault.
>
>     Any help would be extremely appreciated.
>
>
>     Bryan T. Richmond
>     Software Engineer
>     Environmental Sensors
>
>     INFICON, Inc
>     2 Technology Place
>     East Syracuse, NY 13057-9714
>
>     Phone: (315) 434-2559 <tel:%28315%29%20434-2559>
>     Fax:      (315) 437-3803 <tel:%28315%29%20437-3803>
>
>     E-Mail: [hidden email] <mailto:[hidden email]>
>     Web: www.INFICON.com <http://www.INFICON.com>
>
>     **********************************************************************
>     NOTICE: - This message including any attachments is intended only for the use of the
>     designated recipient(s) named above and may contain confidential information protected
>     by law.  If you are not the intended recipient, you are hereby notified that any
>     disclosure, copying, distribution, or the taking of any action in reliance on the
>     contents of this information is strictly prohibited.  If you have received this
>     transmission in error, please notify the sender immediately by e-mail and delete the
>     original message including any attachments.
>     ***********************************************************************
>
>
>
> ------------------------------------------------------------------------------------------
>
> *libftdi* - see http://www.intra2net.com/en/developer/libftdi for details.
> To unsubscribe send a mail to [hidden email]
> <mailto:[hidden email]>
>
>


--
Nathaël PAJANI - ED3L - Techno-Innov
Internet : http://www.ed3l.fr - http://www.techno-innov.fr

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how can I get usb port number?

Thomas Jarosch
In reply to this post by Bryan.Richmond
On Monday, 31. August 2015 10:58:43 [hidden email] wrote:
> I'm trying to figure out a way to find out which usb port a device is
> connected to.  I have mulitiple of the same type of FT2232H chips hooked
> up.   libusb has this command libusb_get_port_numbers. but it takes a
> libusb_device as an argument.
>
> I tried to use libusb_get_device((&ftdic)->usb_dev), but this gave me a
> segfault.

The construct

"(&ftdic)->usb_dev"

looks a bit unusual. Please show the full variable
declaration of "ftdic" if this problem is still of concern.

Also, if you get a segfault, you can always
try to run your program with "valgrind" or gdb
to get a meaningful stacktrace.

Best regards,
Thomas


--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how can I get usb port number?

Rogier Wolff
On Mon, Sep 07, 2015 at 04:11:43PM +0200, Thomas Jarosch wrote:

> The construct
>
> "(&ftdic)->usb_dev"
>
> looks a bit unusual.

I first expected that it would need to be: ftdic->usb_dev, however,
maybe that's wrong: the "ftdic" variable is a structure, and not a
pointer to such. You probably pass &ftdic to all the functions.

The normal way of writing that is:

  ftdic.usb_dev


Roger.

--
** [hidden email] ** http://www.BitWizard.nl/ ** +31-15-2600998 **
**    Delftechpark 26 2628 XH  Delft, The Netherlands. KVK: 27239233    **
*-- BitWizard writes Linux device drivers for any device you may have! --*
The plan was simple, like my brother-in-law Phil. But unlike
Phil, this plan just might work.

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Loading...