Repository navigation
Report printers Labelburg finds but cannot print on yet - #323
Merged
Merged
Conversation
`/api/printer_status` lists them in `unknown`, each with a report and the new printer form on GitHub filled in with it: on USB the printers no driver claims and devices of makers of label printers without a printer interface, on Bluetooth the Niimbot models and P-touch printers no driver prints on. Nothing is sent to them. The report names the USB IDs, the fields of the device ID that name the model and the Bluetooth name without its serial number, never serial numbers, addresses or paths. A printer of `/dev/usb/lp<N>` whose device ID names another maker than Brother, or an office printer, no longer gets Brother's status request `ESC i S`, which another printer may print. Signed-off-by: DL6ER <dl6er@dl6er.de>
Each gets a card under Printers with "Copy report" and "Report it on GitHub", which asks before it opens the form like other links to the internet. The card names the printer only, the IDs are in the report. Where the browser keeps the clipboard to itself, e.g. without HTTPS, the report is shown to copy by hand. Signed-off-by: DL6ER <dl6er@dl6er.de>
`DES` is free text, e.g. an owner's name or a host name, and is told only where it repeats maker and model. A field ends before `SN`, `S/N`, `SERIAL`, `MAC`, `IP`, `HOST` or `OWNER`, and MAC addresses are caught as 12 hex digits with or without separators, also in groups of four, besides IPv6 addresses holding IPv4 ones and paths. Signed-off-by: DL6ER <dl6er@dl6er.de>
With Niimbot's service any short name was taken as the model, e.g. "Niimbot KITCHEN" or "Niimbot MPT" for a renamed receipt printer. The model is now told only where it is one of Niimbot's, a name as Niimbot gives them of another model is told as "Niimbot printer", and other names are not reported. Brother printers are known by their models too: one Labelburg prints on over Bluetooth is left out, one it prints on over USB or the network only is reported "over Bluetooth". Signed-off-by: DL6ER <dl6er@dl6er.de>
A printer found once stayed reported while the server ran, also after it was switched off or taken away. Each search now replaces what the one before found. Signed-off-by: DL6ER <dl6er@dl6er.de>
A `/dev/usb/lp<N>` without a device ID got Brother's status request `ESC i S` whatever its vendor ID, e.g. a POS-58 clone, which takes `ESC i` as a cut, and so did Brother's host-based lasers (`CMD:PJL,HBP`). Without a device ID it is now asked only where the vendor ID is Brother's or unknown, and no device whose device ID names the commands of an office printer, also PJL and the lasers the computer draws for, is asked. A printer no driver prints on is reported only where its vendor ID or device ID names a maker of label printers or the device ID names the commands of label printers. Samsung, HP and Canon lasers were reported as label printers. Signed-off-by: DL6ER <dl6er@dl6er.de>
The search asks printers on USB through PyUSB for both, which the guide, the README and the API description left out by saying that nothing is sent to them. Nothing else is sent to find out what a device is. Signed-off-by: DL6ER <dl6er@dl6er.de>
… it" The card had a sentence for a title, two lines of hints and two buttons. It now has the printer's name, "Not supported yet, a report helps to add it." and one button "Report it", which opens the form. What the report holds and the guide are told in the form. The report stays in `/api/printer_status` as `report`. Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
…nters Signed-off-by: DL6ER <dl6er@dl6er.de>
A DYMO LabelWriter that tells no device ID is known to its driver by its vendor and product ID. The search asked only printers whose device ID names a model, so it reported this one as a printer Labelburg cannot print on and never listed it. Signed-off-by: DL6ER <dl6er@dl6er.de>
…unknown printers The Niimbot driver takes every device of Niimbot without a printer interface as a serial port, `(0x3513, None)` in `usb_serial_ids`. The search compared the exact vendor and product IDs only, so it reported a Niimbot B1 on USB as a printer Labelburg cannot print on. `found_devices()` now leaves out what `_serial_listed()` claims. Signed-off-by: DL6ER <dl6er@dl6er.de>
…by their whole name A B21 heard on classic Bluetooth only, which the Niimbot driver does not claim there, was reported as a printer Labelburg cannot print on, as the list of niimbluelib models holds the printed ones too. A name and Niimbot's service counted as printed where the model only began a printed one, e.g. D1 for the D110. Signed-off-by: DL6ER <dl6er@dl6er.de>
…e ID names no maker Brother's status request went by the vendor ID only where a printer told no device ID at all. A Brother printer whose device ID lacks `MFG` was neither asked nor reported, though its status names its model. The vendor ID is `drivers.brother.USB_VENDOR` now instead of a copy. Signed-off-by: DL6ER <dl6er@dl6er.de>
A printer on USB that no driver prints on and that is neither a label printer nor an office printer is not asked, so that it does not take Brother's status request as a cut. It was left out of the list without a word, as if the search had not seen it. The Settings now tell it below the printers, e.g., "Found Acme Bar on USB, Labelburg cannot print on it", once for each kind. Office printers stay out. Signed-off-by: DL6ER <dl6er@dl6er.de>
…v/usb/lp<N>` once Without libusb the search for the devices of makers of label printers cannot find any, yet it ran after the search for printers had failed for that reason. A printer on `/dev/usb/lp<N>` that a driver knows was resolved to its driver and model to decide whether to ask it, then once more to ask it. Signed-off-by: DL6ER <dl6er@dl6er.de>
The form for new printers had its own copy of the version as the Settings tell it and of the address of the forms, next to those of the bug form. Both now come from `issue_forms.py`, which imports nothing of the printers, as `printer.py` imports `unknown.py`. Signed-off-by: DL6ER <dl6er@dl6er.de>
…rinter.md` The guide said that Brother's status request goes to every printer whose device ID names a model of a driver, but such a printer gets the request of its driver. It now also names the printers a driver knows by their USB IDs, the devices a driver reaches as serial ports and the printers only named below the printers. Signed-off-by: DL6ER <dl6er@dl6er.de>
The search for printers on PyUSB listed the USB devices twice, for printers and for serial ports, and the search for other devices of makers of label printers a third time. Within `one_listing()` both read one listing, which a detection takes once. The fakes of PyUSB in the tests list without `custom_match`, and the test of a missing libusb takes it away from that listing. Signed-off-by: DL6ER <dl6er@dl6er.de>
… its raster commands A Brother printer, by its device ID or vendor ID, got `ESC i S` whatever command set it named, e.g., a TD printer naming only XPP, which may print the bytes as garbage. Now a printer a driver knows gets its driver's request first, and Brother's goes only to one naming no commands or PT-CBP, as on PyUSB. Signed-off-by: DL6ER <dl6er@dl6er.de>
An Epson ColorWorks names the commands of Epson's inkjets, e.g., `ESCPL2`, so it counted as an office printer and was never reported. A device ID that names a maker of label printers or a line of them, ColorWorks, QL, PT or TD, now counts as a label printer whatever commands it names. Signed-off-by: DL6ER <dl6er@dl6er.de>
Each search replaced the printers on Bluetooth that no driver prints on, so one that missed a round of advertising left the Settings and came back with the next search. It now stays until three searches in a row have missed it, as network printers stay for three rounds of their search. Signed-off-by: DL6ER <dl6er@dl6er.de>
…nters The report dropped every word of five digits or more as a serial number, e.g., the model ZT41042, where `devices.device_name()` takes six, and joined maker and model its own way. It now takes the same rule and names the printer with `device_name()`. Signed-off-by: DL6ER <dl6er@dl6er.de>
A thread-local cache kept the listing of the USB devices, and with it the devices the search for printers had opened, while the printers were asked, where a second open of one can fail as busy. A detection now lists the USB devices once with `devices.usb_listing()`, with the interfaces of each device and the bus IDs Linux shares over USB/IP read once, passes it to `found_printers()` and `found_devices()`, and lets it go before it asks the printers. Signed-off-by: DL6ER <dl6er@dl6er.de>
…or ID from its driver Each device a Bluetooth search found sorted Brother's models and matched them one by one, and the models Labelburg prints on were put in capitals for each. Both are built once now. The vendor ID of DYMO comes from `drivers.dymo.VENDOR_ID`, and the docstring of `_usblp_printers()` says only why. Signed-off-by: DL6ER <dl6er@dl6er.de>
…est and which are office printers Brother's status request goes only to Brother printers that name no commands or its raster commands, and a device ID naming a maker or line of label printers, e.g., an Epson ColorWorks, is no office printer's. Signed-off-by: DL6ER <dl6er@dl6er.de>
The search on `/dev/usb/lp<N>` sent it to Brother printers naming no commands or any command with "PT-", the one on PyUSB only to those naming `PT-CBP` or no device ID. Both now take `unknown.asks_brother()`: a Brother printer by its device ID or vendor ID that names `PT-CBP` or tells no device ID. Signed-off-by: DL6ER <dl6er@dl6er.de>
…laims its address A printer the search had found as one Labelburg cannot print on stayed among them for up to three searches after a driver had claimed its address, so the Settings showed it twice. The searches now drop the addresses they found as printers when they age the unknown ones. Signed-off-by: DL6ER <dl6er@dl6er.de>
…holder maker by the vendor ID Since the report named printers as the printer list does, it kept words of five digits, e.g., a serial number X12345, and sent them to GitHub with the form. The Settings now name a printer by the rule of `devices.device_name()`, six digits, so a model like ZT41042 stays there, while the report and the form leave out every word of five digits. A device ID naming "Printer", "Generic" or "Unknown" as the maker took no maker at all, it now takes the one of the vendor ID, e.g., "Zebra printer". Signed-off-by: DL6ER <dl6er@dl6er.de>
Only device IDs that were told were kept, so a printer that tells none was asked again for each lookup of the detection, by `usb_device_id()` and by `drivers.resolve()`, opening it each time. The search now keeps those that told none until the next detection. Signed-off-by: DL6ER <dl6er@dl6er.de>
One device whose descriptors could not be read left the whole listing empty, so no printer on PyUSB was found. Now only that device is left out. Signed-off-by: DL6ER <dl6er@dl6er.de>
`found_printers()` now releases each printer with `usb.util.dispose_resources()` once its serial number and device ID are read, also where reading failed, instead of the detection dropping the whole listing before it asks the printers. Signed-off-by: DL6ER <dl6er@dl6er.de>
An office printer was resolved to a driver before it was taken for one, so a driver that claimed it would have sent it its status request. The office check now comes first. Signed-off-by: DL6ER <dl6er@dl6er.de>
A module global kept the printers that told no device ID until the next detection, so one busy while the search asked it was never asked again when it printed, and with configured printers until a restart. The detection now passes the device IDs the search read, also the empty ones, to its lookups and to `drivers.resolve()`, which takes one it was told. Signed-off-by: DL6ER <dl6er@dl6er.de>
…first The search on PyUSB still looked for a driver of a printer and asked it before it checked for an office printer, so on macOS, or on Linux without usblp, an office printer a driver claimed got its status request. Both searches now sort each printer with `_sort_usb()`, which leaves an office printer before any driver is looked for. Signed-off-by: DL6ER <dl6er@dl6er.de>
…printers Only the printers the same search found were left out, so one a driver had claimed before and that the next search heard under another name was listed twice. The unknown printers are now checked against all printers found on Bluetooth. Signed-off-by: DL6ER <dl6er@dl6er.de>
A Brother printer naming its raster commands in small letters, `pt-cbp`, was not sent Brother's status request, which tells its model. Signed-off-by: DL6ER <dl6er@dl6er.de>
…endor ID A device ID that did not parse counted as none, and a printer telling none whose USB IDs could not be read, e.g., in a container, got `ESC i S` too, which a receipt printer takes as a cut. Now only a device ID read empty counts as none, and such a printer is asked only where its vendor ID is Brother's. Signed-off-by: DL6ER <dl6er@dl6er.de>
Without a cache of an empty device ID, every read of one asked the printer again, e.g., the poll of the label designer that follows it and each read of its settings, each a listing of the USB devices and a claim of the printer, maybe while a job held it. An empty device ID is now kept for 60 s, and forgotten at once when a read tells one or the detection no longer finds the printer. The detection passes the device IDs it read no longer, and `drivers.resolve()` takes none again. Signed-off-by: DL6ER <dl6er@dl6er.de>
The search on PyUSB resolved a printer with the model its device ID named, as if it had been configured, so a printer could be shown otherwise on PyUSB than on usblp. `_sort_usb()` now resolves every printer it sorts with an unknown model. Signed-off-by: DL6ER <dl6er@dl6er.de>
…nters Signed-off-by: DL6ER <dl6er@dl6er.de>
The detection went through them to forget those it no longer found while request threads added to them, which can fail it with "dictionary changed size during iteration". Both now take a lock. Signed-off-by: DL6ER <dl6er@dl6er.de>
A read of the device ID that failed, e.g., with the printer busy or its interface not claimed, counted as an empty answer and was kept for a minute. A configured printer on usb:// whose first read failed then fell back to the driver of the default model meanwhile, e.g., Brother's status request to an ESC/POS printer, which cuts. `backends.device_id()` now tells a failed read as None, which is not kept. Signed-off-by: DL6ER <dl6er@dl6er.de>
A printer that does not take GET_DEVICE_ID stalls it, which counted as a failed read, so it was asked again on every read. Only a printer busy, its claim refused or no answer in time is a failed read now, anything else an answer without a device ID, which is kept. The tests also start without the device IDs other tests kept. Signed-off-by: DL6ER <dl6er@dl6er.de>
…hout libusb A printer on usb:// that is not plugged in, or a computer without libusb, counted as a failed read, so every read of the device ID listed the USB devices again or looked for libusb again. Both tell no device ID again, which is kept for a minute. Signed-off-by: DL6ER <dl6er@dl6er.de>
…last A printer busy while the detection asked it was listed without a device ID, so a Brother laser told before passed the check for office printers and got Brother's status request by its vendor ID. The detection now takes the device ID it told last, where it told one. Signed-off-by: DL6ER <dl6er@dl6er.de>
The thread that keeps a printer while the detection goes through them could write into the dictionary of the module after the test had ended. The test now waits for it and checks what it kept. `found_printers()` names a device ID that may be None, and a comment no longer says that a busy printer is kept. Signed-off-by: DL6ER <dl6er@dl6er.de>
… last Only a read that failed as busy, refused or timed out took the device ID a printer had told before. Most others, e.g., an I/O error, read as none, so a Brother laser that had told its device ID was listed without one and got Brother's status request by its vendor ID. Every read that tells none now takes the one it told last. Signed-off-by: DL6ER <dl6er@dl6er.de>
Every error of a read but busy, refused or timed out counted as an answer without a device ID and was kept for a minute, e.g., a single I/O error or an error libusb names no further. Only a stall, which tells that the printer does not take the request, is an answer now, every other error a read that failed. Signed-off-by: DL6ER <dl6er@dl6er.de>
A printer added by its address before it was plugged in told no device ID, which is kept for a minute, so adding it again right after plugging it in was refused as no printer. Adding one by its address now always asks it. Signed-off-by: DL6ER <dl6er@dl6er.de>
Remembering for a minute that a printer told no device ID kept bringing up cases where it was wrong, e.g., a printer plugged in since was refused when added. A printer on usb:// keeps only a device ID it told, as before this branch, and one without is asked again. A failed read and a stall still tell None and an empty device ID apart. Signed-off-by: DL6ER <dl6er@dl6er.de>
A printer that answered no device ID, e.g., with a stall, took the one told before under its key, which another printer may have told where they share it, e.g., the same model without a serial number. Only a read that failed, e.g., busy, takes it now. Signed-off-by: DL6ER <dl6er@dl6er.de>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Label printers Labelburg cannot print on yet, e.g., a DYMO LabelWriter 550 on USB or a Niimbot B31 on Bluetooth, were left out of the search silently. Now the Settings show each with its name and "Report it", which opens a new printer form on GitHub with the report filled in. Other USB printers get one line, e.g., "Found Acme Bar 200 on USB, Labelburg cannot print on it".
The report holds the version, connection, USB IDs, the model fields of the device ID and the Bluetooth name, never serial numbers, addresses, paths or names a printer was given.
USB printers are asked for their device ID and serial number, nothing else, and Brother's status request now goes only to printers that name it.
printer_statuslists them inunknown, seedocs/new-printer.md.