-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change USB device identifier #63
base: master
Are you sure you want to change the base?
Conversation
really preferring the device vendorId/productId over serial number happened in 97f5821 - this PR has to rebased if that got merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it, the "pin" is a nice tough although it's probably not intuitive for most users to understand why it is there… Still, for a power-user feature it's nice.
I'm mainly worried currently about the following: The motivation behind preferring product ID over serial number was that, if I have 3 cashdesks and 3 printers, I no longer need to care which printer I plug into which cashdesk …
… but have we tested that this is actually true? If I grant pretixPRINT permission for a USB device, does the Android system persist the permission based on the serial number or based on the product id? In other words, if I switch between printers of the same model, do we need to go through pretixPRINT again anyways to get the permission? Or would it just work?
pretixprint/app/src/main/java/eu/pretix/pretixprint/ui/USBSettingsFragment.kt
Show resolved
Hide resolved
… button. It also now uses the device vendorid:productid indentifier as default and offers a pin button to really use the device serial number, if available.
This is backwards compatible with the old missing zeros format and doesn't change configuration.
…ther chosen device doesn't provide a serial number
I have tested it: It does not work. I have used two Epson TM-m30ii with the same product/vendor ID. After connecting one printer, I closed the app, switched to the other printer and tried to print a receipt, the printer was not found. Only after I re-selected it in pretixPRINT and confirmed the system-level USB permission again, it worked. Does this PR even make sense then? :( |
Okay, at least switching back works. So if I authorize all my printers on all my devices once, I can then switch, so there's a little upside to this PR. Still, the user experience is weird if the config shows the correct IDs and it says "printer not found". Should we try to detect this case and give a better error message? |
adf31f3
to
e1a4b01
Compare
This PR changes the USB device identifier to actually use leading zeros, if the usb vendor id / product id uses them - and prefer that over the device serial number by default.
It also includes some UX improvements by moving the device identifier textfield next to the choose device button (to make them seem more related), changing the compatibility mode switch to a checkbox and offering users to "pin" the device by click, to use the device serial number again.