Do I always have to reconnect my usb accessory before opening it ?

Dirk A

Member
Licensed User
Longtime User
Hi ,

I'm connecting my Ftdi device using usbserial . I can open the device , read & write data etc... (thanks to Agraham). My only problem is that when I have opened the device once using my program and I restart my program I have to disconnect my usb cable and reconnect it in order to be able to open the device again otherwise I can't communicate with the device. Is there anything I can do about it ?

I also have to give permission each time the cable is reconnected (even though I check to "always use this program for the device" )

When I exit my program I call the close function of usberial ...
 

Dirk A

Member
Licensed User
Longtime User
Yes, I call ExitApplication but it doesn't make a difference.
Is it possible to "re-discover your accessories" ? So that android says "an accessory has been connected" without disconnecting your usb cable ?
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
From one of my Arduino ADK Accesssory tutorials.

this is the Stack Overflow link android - Proper way to close a USB accessory connection - Stack Overflow
 
Upvote 0

Dirk A

Member
Licensed User
Longtime User
I allready had the exit button that calls exitapplication. So the only option left is look for a way to do a software reset of the device, right ? So that the device itself closes all pending connections... Then I think i wil have to contact FTDI about it because even their demo has the problem
 
Last edited:
Upvote 0

agraham

Expert
Licensed User
Longtime User
Then I think i wil have to contact FTDI about it because even their demo has the problem
No real point. It's an Android bug that leaves a FileDescriptor open. Disconnecting and reconnecting the devices makes Android close it as long as your process is also dead.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…