As already mentioned in #218 , when a device gets opened, the state is reset and the last configured state cannot be retrieved anymore.
I was able to workaround this by temporarily monkey-patching out the set_bitmode function:
And i could verify that indeed this works for my use-case: I can set the GPIO state in one invocation of the script and i can retrieve the state with above workaround in another invocation of the script. I also verified that after a ftdi.reset(usb_reset=True) the approach still works but then obviously returns the default state (by which i mean that calling read() seems to be ok even if set_bitmode has not been called before on the device)
But obviously this is a quite nasty workaround and i wonder whether maybe it could be supported maybe as a special kind of GpioReadOnceController or something?
Using pyftdi==0.55.0 .
As already mentioned in #218 , when a device gets opened, the state is reset and the last configured state cannot be retrieved anymore.
I was able to workaround this by temporarily monkey-patching out the set_bitmode function: And i could verify that indeed this works for my use-case: I can set the GPIO state in one invocation of the script and i can retrieve the state with above workaround in another invocation of the script. I also verified that after a ftdi.reset(usb_reset=True) the approach still works but then obviously returns the default state (by which i mean that calling read() seems to be ok even if set_bitmode has not been called before on the device)
But obviously this is a quite nasty workaround and i wonder whether maybe it could be supported maybe as a special kind of GpioReadOnceController or something?