Skip to content
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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Change USB device identifier #63

wants to merge 6 commits into from

Conversation

robbi5
Copy link
Contributor

@robbi5 robbi5 commented Aug 9, 2023

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.

Screenshot_20230809_184533

@robbi5
Copy link
Contributor Author

robbi5 commented Aug 9, 2023

really preferring the device vendorId/productId over serial number happened in 97f5821 - this PR has to rebased if that got merged.

Copy link
Member

@raphaelm raphaelm left a 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?

robbi5 and others added 6 commits August 25, 2023 09:42
… 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
@raphaelm
Copy link
Member

… 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?

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? :(

@raphaelm
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants