Open ge0rg opened 8 years ago
I guess this would allow to auto open the serial port when the device is just connected. Am I right?
Exactly. If you have only one supporting app installed, it is opened directly; if you have multiple apps, you get a ttypical chooser intent dialog.
This should be implemented by the application and not by the library. Including it by default would mean every app would have this behavior even if they didnt want it.
The application needs to include a device filter XML for this feature to work. My suggestion is merely to provide such an XML file as part of the library, so that app developers have an easier time integrating.
Indeed XML file(s) ready populated with the vid+pid pairs in the /java/com/felhr/deviceids namespace source files would be very handy.
xml attached in text file below - created from sources off github
The USB Host SDK provides an intent filter for USB attach events, that can be used to auto-launch your app when a certain USB device is attached.
It would be great to have such a
device_filter.xml
file as part of the usbserial source code (or even AAR), based on the vendor/product IDs supported by UsbSerial. It is possible to create a momentary snapshot of the supported IDs thanks to the consistent style in thedeviceids
directory, using this black magic incantation (you just need to mix in some XML boilerplate):However, it would be nicer and cleaner to have the XML either auto-generated in the build process or (manually?) updated with new device IDs. It is probably also possible to replace many of the entries by a vendor/class or similar combination, instead of listing all supported IDs.