>> is there is something pending in the read buffer I check the readbuffer_remaining field of the ftdi_context struct [1] returned by ftdi_new() [2].
>> a way to set the read timeout via libftdi. The same ftdi_context struct also has a field usb_read_timeout [3] .. but I have not used that one so far. There is also a timeout inside the ftdi IC, which is called latency timer, which you set with ftdi_set_latency_timer() [4] I am just a libftdi user of libftdi 1.4, not a developer nor maintainer, so I hope above is still useful. Berni [1] https://www.intra2net.com/en/developer/libftdi/documentation/structftdi__context.html [2] https://www.intra2net.com/en/developer/libftdi/documentation/group__libftdi.html#gafd46c6784367fd95c5f852d3b38949a8 [3] https://www.intra2net.com/en/developer/libftdi/documentation/structftdi__context.html#afa159483bb1153259ee7ceb3b45a2c9f [4] https://www.intra2net.com/en/developer/libftdi/documentation/group__libftdi.html#ga3e0227b0c7aa859d2d2afb5ffa4c8466 On Mon, Dec 17, 2018 at 4:56 PM <[email protected]> wrote: > Hello, > > For a user programm to determine if a connected FTDI device has the 60 > MHz clock option (e.g. FT2232H) or not (e.g. FT2232D), I only see on > way: > - Send the Disable Clk Divide by 5 command (0x8a) > - Observe if the command is accepted or not. > > In the case the command succeeds, nothing will happen. A FT2232D will > not understand the command and so will send "BAD COMMAND" (0xfa) > followed by the command (0x8a). In the case of a FT2232D, a read(2) > would succeed. However on a device that knows the command, no output > is generated. Some read will hang until our 5000 ms timeout is elapsed > and make this approach user unfriendly. > > Two things could help in this situation: > - either have a way to query the device via libftdi is there is > something pending in the read buffer > - or have a way to set the read timeout via libftdi. > > I neither see any of those two ways. Do I miss something? > > A workaround sees to be: > send DIS_DIV_5 > send GET_BITS_LOW > send GET_BITS_LOW > read two byte > if bytes read are 0xfa DIS_DIV_5 > device has slwo clock > read two bytes > else > device has 60 MHz clock. > > Some BAD_COMMAND definition also misses in out headers. > > Bye > > -- > Uwe Bonnes [email protected] > > Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt > --------- Tel. 06151 1623569 ------- Fax. 06151 1623305 --------- > > -- > libftdi - see http://www.intra2net.com/en/developer/libftdi for details. > To unsubscribe send a mail to [email protected] > > > -- libftdi - see http://www.intra2net.com/en/developer/libftdi for details. To unsubscribe send a mail to [email protected]
