How to query the device serial number of an already opened connection

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

How to query the device serial number of an already opened connection

Alex Scarbro
Hello,

I'm working on an improved LCDproc HD44780 driver using the FTDI FT2232D to add keypad support.

I have both interfaces working perfectly, but would like to tell the user what the serial number is of the interface that has been opened.

Is it possible to query the serial number of an interface that has already been opened?

e.g.

    /* open LCD channel*/
    ftdi_init(&p->ftdic);
    ftdi_set_interface(&p->ftdic, INTERFACE_A);
    ftdi_usb_open(&p->ftdic, ftdiVendorIdLcd, ftdiProductIdLcd);

    <QUERY OPENED SERIAL NUMBER HERE>

    printf("Opened device serial number is: %s",serilaNo);
    ftdi_deinit(&p->ftdic);

Best regards,

Alex


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 to query the device serial number of an already opened connection

Ryan Tennill
I believe what you're looking for is provided by ftdi_usb_get_strings() with the caveat that it closes the device after use.

http://www.intra2net.com/en/developer/libftdi/documentation/group__libftdi.html#ga17e8eae09e58bd3bfeeab8decfce7fd9

Ryan

On 10/18/2015 10:36 AM, Alex Scarbro wrote:
Hello,

I'm working on an improved LCDproc HD44780 driver using the FTDI FT2232D to add keypad support.

I have both interfaces working perfectly, but would like to tell the user what the serial number is of the interface that has been opened.

Is it possible to query the serial number of an interface that has already been opened?

e.g.

    /* open LCD channel*/
    ftdi_init(&p->ftdic);
    ftdi_set_interface(&p->ftdic, INTERFACE_A);
    ftdi_usb_open(&p->ftdic, ftdiVendorIdLcd, ftdiProductIdLcd);

    <QUERY OPENED SERIAL NUMBER HERE>

    printf("Opened device serial number is: %s",serilaNo);
    ftdi_deinit(&p->ftdic);

Best regards,

Alex


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



-- 

217-351-2655 ext. 126
Distant Focus Corporation
4114B Fieldstone Rd
Champaign, IL 61822
http://jupiter.distantfocus.com/projects/


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 to query the device serial number of an already opened connection

Alex Scarbro
Hello Ryan,

Thank you for your reply. 

Yes, I have already used this function - as per the "find_all" example. Unfortunately, whilst it works perfectly to list all the available detected when used in conjunction with the ftdi_usb_find_all(), I'm interested in what the serial number is of the opened device - since the ftdi_usb_open() function could actually open any FTDI device with the same VID/PIDs.

I realise I could use the ftdi_usb_open_desc() function, and In fact I am already, but I also want to offer the LCDproc user the option of just opening by VID/PID, since the ftdi_usb_get_strings() sometimes times out:

" ftdi_usb_get_strings failed: -7 (error sending control message: Connection timed out) "

Best regards,

Alex

On Mon, Oct 19, 2015 at 5:40 PM, Ryan Tennill <[hidden email]> wrote:
I believe what you're looking for is provided by ftdi_usb_get_strings() with the caveat that it closes the device after use.

http://www.intra2net.com/en/developer/libftdi/documentation/group__libftdi.html#ga17e8eae09e58bd3bfeeab8decfce7fd9

Ryan


On 10/18/2015 10:36 AM, Alex Scarbro wrote:
Hello,

I'm working on an improved LCDproc HD44780 driver using the FTDI FT2232D to add keypad support.

I have both interfaces working perfectly, but would like to tell the user what the serial number is of the interface that has been opened.

Is it possible to query the serial number of an interface that has already been opened?

e.g.

    /* open LCD channel*/
    ftdi_init(&p->ftdic);
    ftdi_set_interface(&p->ftdic, INTERFACE_A);
    ftdi_usb_open(&p->ftdic, ftdiVendorIdLcd, ftdiProductIdLcd);

    <QUERY OPENED SERIAL NUMBER HERE>

    printf("Opened device serial number is: %s",serilaNo);
    ftdi_deinit(&p->ftdic);

Best regards,

Alex


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



-- 

<a href="tel:217-351-2655%20ext.%20126" value="+12173512655" target="_blank">217-351-2655 ext. 126
Distant Focus Corporation
4114B Fieldstone Rd
Champaign, IL 61822
http://jupiter.distantfocus.com/projects/


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





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 to query the device serial number of an already opened connection

Uwe Bonnes
>>>>> "Alex" == Alex Scarbro <[hidden email]> writes:

    Alex> Hello Ryan, Thank you for your reply. 

    Alex> Yes, I have already used this function - as per the "find_all"
    Alex> example.  Unfortunately, whilst it works perfectly to list all the
    Alex> available detected when used in conjunction with
    Alex> the ftdi_usb_find_all(), I'm interested in what the serial number
    Alex> is of the opened device - since the ftdi_usb_open() function could
    Alex> actually open any FTDI device with the same VID/PIDs.

    Alex> I realise I could use the ftdi_usb_open_desc() function, and In
    Alex> fact I am already, but I also want to offer the LCDproc user the
    Alex> option of just opening by VID/PID, since the
    Alex> ftdi_usb_get_strings() sometimes times out:

    Alex> " ftdi_usb_get_strings failed: -7 (error sending control message:
    Alex> Connection timed out) "

xc3sprog in ioftdi.cpp also offers an option to open with VID/PID and
serial.
      // Open device
      res = ftdi_usb_open_desc(ftdi_handle, vendor, product,
                               description, serial);

Keep description NULL and you don't need to the the description.

Bye
--
Uwe Bonnes                [hidden email]

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------

--
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 to query the device serial number of an already opened connection

Alex Scarbro
Hello,

Thank you for your reply.

As mentioned, I wish to know the serial number for the connection I have already opened, since the tdi_usb_get_strings() function sometimes times out, meaning the ftdi_usb_open_desc() function also fails. Therefore, sometimes the user has to open by VID/PID only. In which case I would like to at least confirm to the user which serial number has actually been opened!

There must be a way!

Best regards,

Alex

On Tuesday, October 20, 2015, Uwe Bonnes <[hidden email]> wrote:
>>>>> "Alex" == Alex Scarbro <<a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;alex.scarbro@googlemail.com&#39;)">alex.scarbro@...> writes:

    Alex> Hello Ryan, Thank you for your reply. 

    Alex> Yes, I have already used this function - as per the "find_all"
    Alex> example.  Unfortunately, whilst it works perfectly to list all the
    Alex> available detected when used in conjunction with
    Alex> the ftdi_usb_find_all(), I'm interested in what the serial number
    Alex> is of the opened device - since the ftdi_usb_open() function could
    Alex> actually open any FTDI device with the same VID/PIDs.

    Alex> I realise I could use the ftdi_usb_open_desc() function, and In
    Alex> fact I am already, but I also want to offer the LCDproc user the
    Alex> option of just opening by VID/PID, since the
    Alex> ftdi_usb_get_strings() sometimes times out:

    Alex> " ftdi_usb_get_strings failed: -7 (error sending control message:
    Alex> Connection timed out) "

xc3sprog in ioftdi.cpp also offers an option to open with VID/PID and
serial.
      // Open device
      res = ftdi_usb_open_desc(ftdi_handle, vendor, product,
                               description, serial);

Keep description NULL and you don't need to the the description.

Bye
--
Uwe Bonnes                <a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;bon@elektron.ikp.physik.tu-darmstadt.de&#39;)">bon@...

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to <a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;libftdi+unsubscribe@developer.intra2net.com&#39;)">libftdi+unsubscribe@...



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 to query the device serial number of an already opened connection

VDR User
> tdi_usb_get_strings()

Would it be horrible to retry that if it times out, assuming the
timeouts are random. It might be a crap solution but if there's no
real alternative..?

--
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 to query the device serial number of an already opened connection

Alex Scarbro
I could certainly give that a go!

I'd not encountered it happening during all my windows+Labview work with the FTDI parts, so libftdi is new territory for me!

Best regards,
Alex

On Wednesday, October 21, 2015, VDR User <[hidden email]> wrote:
> tdi_usb_get_strings()

Would it be horrible to retry that if it times out, assuming the
timeouts are random. It might be a crap solution but if there's no
real alternative..?

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to <a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;libftdi+unsubscribe@developer.intra2net.com&#39;)">libftdi+unsubscribe@...



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 to query the device serial number of an already opened connection

Ryan Tennill
On 10/21/2015 06:04 PM, Alex Scarbro wrote:
I could certainly give that a go!

I'd not encountered it happening during all my windows+Labview work with the FTDI parts, so libftdi is new territory for me!

Best regards,
Alex

On Wednesday, October 21, 2015, VDR User <[hidden email]> wrote:
> tdi_usb_get_strings()

Would it be horrible to retry that if it times out, assuming the
timeouts are random. It might be a crap solution but if there's no
real alternative..?

Another option might be to reimplement ftdi_usb_get_strings() in your own code but leave the device open. I don't know if there's a good reason for always closing the device but it should be really easy to test out.

Ryan

-- 

217-351-2655 ext. 126
Distant Focus Corporation
4114B Fieldstone Rd
Champaign, IL 61822
http://jupiter.distantfocus.com/projects/


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


Loading...