Wikipedia:Reference desk/Archives/Computing/2020 January 13

= January 13 =

Tiny Linux-friendly laser printer
If you look up "Samsung ML-2160" with a search engine you'll find a cool piece of hardware, a super compact laser printer that unfortunately has a craptacular Linux driver situation (binary-only module from Samsung with slowly worsening compatibility with CUPS/foomatic/whatever). Does anyone know of a laser printer (no inkjets please!) that uses a standardized command set (PS, PCL or whatever) instead of a stupid proprietary one, that is in a similar physical small form factor? I do have a fairly small Brother laser printer on another machine, that works well, but it is not as small as the Samsung mentioned. Thanks for any suggestions/recommendations. 2601:648:8202:96B0:C923:B226:7FA3:2DDD (talk) 05:41, 13 January 2020 (UTC)
 * The Brother HL-1210W seems to be a similar size ([//support.brother.com/g/b/spec.aspx?c=nz&lang=en&prod=hl1210w_eu]_340 mm x 238 mm x 189 mm) to the Samsung ML-2160 ([//www.comx-computers.co.za/SAMSUNG-ML-2160-specifications-71670.htm] 331 x 215 x 178mm). But AFAICT the Linux situation is not much better [//www.openprinting.org/printer/Brother/Brother-HL-1210W] [//community.linuxmint.com/hardware/view/25548] [//aur.archlinux.org/packages/brother-hl1210w/] [//web.archive.org/web/20171127234852/https://sites.google.com/site/easylinuxtipsproject/15] [//dontsurfinthenude.blogspot.com/2018/03/installing-brother-hl-1212-w-fi-mono.html] [//support.brother.com/g/b/faqend.aspx?c=gb&lang=en&prod=hl1210w_eu_as&faqid=faq00100602_000] [//distrowatch.com/dwres.php?resource=ratings&distro=void&story=17115]. BTW, I think the 1211W and 1212W are basically the same printer, just releases for different regions so they may be what you find depending on where you live.  You can try using some default generic open source brother driver but it doesn't seem to work well at least as of a few years ago. Alternatively you can using proprietary Brother drivers. [//support.brother.com/g/b/downloadtop.aspx?c=nz&lang=en&prod=hl1210w_eu_as]. These seem to work well at the moment including on Raspberry Pi's [//www.geekzone.co.nz/forums.asp?forumid=50&topicid=214225&page_no=2] (so I guess there is ARM support). But I guess maybe there is some binary blob hence why no one added more generic support without requiring Brother's proprietary drivers. There's also a chance no one ever bothered since it's not very popular and most people even Linux users don't care that much if it's proprietary if it works and doesn't cause problems. Especially since they probably need to write a spec and get someone to re-write the PPD or whatever to avoid copyright issues. (I hardly ever use Linux so couldn't figure out from the RPM/Deb.) Anyway, how long support will remain, I don't know although at the moment other than Deb or RPM the driver doesn't seem to restrict itself to certain kernel versions.  These may be illustrative of the problem [//wiki.gentoo.org/wiki/Brother_networked_printer] [//forums.freebsd.org/threads/brother-laser-printer-compability.54717/] [//www.openprinting.org/printer/Brother/Brother-HL-1250] [//download.brother.com/welcome/doc002907/Tech_Manual_AC.pdf] [//www.linuxquestions.org/questions/showthread.php?p=5561189]. Such compact printers tend to be also cheap and therefore have low end hardware. To be fair, with most now including network support generally in the form of Wi-Fi, things aren't quite as bad as they were e.g. the 1210W has 32MB. Still the CPU is fairly low speced. Compared to what people had 20 years ago even on high end printers, things aren't that bad so probably they could add PostScript support, but that would require more effort than they're willing to put in especially since I suspect with the advances of both Postscript, and hardware, their modern implementations probably don't work so well on low end hardware.  It seems the Brother 1210W does support PJL [//download.brother.com/welcome/doc002907/Tech_Manual_AC.pdf] but even more so than PCL, that has enough proprietary extensions and caveats that there's no guarantee generic drivers will work very well. So unless someone bothers to adapt the driver to the printer, compatibility may be poor. (To put it a different way, I'm not convinced that SPL is really much worse.) And as mentioned before, I don't think most people care. If it works for them on Linux, the fact it may break in 5 years to 10 years is not something they worry about since they figure they will have a new printer by then. In some countries, e.g. here in NZ, those low end printers can be bought almost free after rebate regularly. (Possibly this was the same for the Samsung printer.) Especially for these low end devices. It's only people in unsupported OSes like *BSD variants, and a small number of advocates who care, and many of them aren't using such low end devices anyway for a variety of reasons.  Incidentally, is there some reason you're still getting drivers from Samsung? HP purchased Samsung's printer division in 2017 [//www.cnbc.com/2017/11/01/hp-completes-purchase-samsung-printer-business.html]. I don't know if they bothered to update the Linux printer driver for this printer, probably not since [//support.hp.com/nz-en/product/samsung-ml-2160-laser-printer-series/17156959] finds a driver last updated in September 2017 for Debian which was before the acquisition was completed. Still you're much more likely to get something from HP than you are for Samsung. Frankly I'm surprised Samsung is still bothering to provide drivers on their site.  Nil Einne (talk) 08:27, 13 January 2020 (UTC)
 * Probably the other thing is that most people who do care about open source etc on Linux, seem to generally prefer HP. [//forums.linuxmint.com/viewtopic.php?t=244602], [//www.reddit.com/r/Ubuntu/comments/5571z2/canon_printer_linux_compatibility/] HP Linux Imaging and Printing seems to be included on many distros. While some do require plug-ins (binary blobs) [//developers.hp.com/hp-linux-imaging-and-printing/binary_plugin.html]) many [//developers.hp.com/hp-linux-imaging-and-printing/supported_devices/index] do not. I mean okay, I'm not quite sure whether Richard Stallman is happy with HP-LIP but it seems even Debian is sort of okay with it [//wiki.debian.org/CUPSPrintQueues?action=show&redirect=PrintQueuesCUPS#hplip] [//packages.debian.org/search?keywords=hplip].  From [//www.printerland.co.uk/blog/2019/04/the-smallest-laser-printers/], it seems the M15w is fairly small. The quoted dimensions there are 346mm (W) x 189mm (D) x 159mm (H). You will get some conflicting info on these figures with some saying ~346 x 348 x 280 mm. AFAICT e.g. [//www.pbtech.co.nz/product/PTRHPL0015/HP-Laserjet-Pro-M15W-World-smallest-printer-in-its] [//www8.hp.com/h20195/v2/GetPDF.aspx/4AA7-2267EEP.pdf], I think this represents the size when the tray is open with paper in the printer, but AFAIK, the Samsung printer is similar so I assumed when replying above you are referring to the closed dimensions. (I had a quick look and I don't think you can keep paper stores in the Samsung's tray when it's closed, even when not in use, at least not without very short paper, or paper sticking out of the tray and probably getting folded and crushed slightly, as with most printers of that type. Sorry if I'm wrong.)  If you want dimensions with the tray open and paper in it, you may need to visit a store since I'm not sure if that info is generally made clear in specs or reviews, although I'm not seeing anything to suggest the Samsung is particularly stellar in that regard. In fact if you were thinking of that size, you may want to look carefully even at printers not known for being small. I mean okay, not massive MFCs with multiple trays and stuff, but I think some e.g. the Brother HLL2375DW don't really take up that much more space (maybe about 20 - 30 mm width and length), it's just that they have a non retracing tray. Depending somewhat on your paper size.  Anyway the M15w does seem to be supported by the HPLIP without a plug-in per the earlier link ([//developers.hp.com/hp-linux-imaging-and-printing/supported_devices/index]). I think the M15a is the same thing but without the WiFi and I think M14-M17 are again the same printer but for different regions so these will be what you want to look out for. [//support.hp.com/us-en/product/hp-laserjet-pro-m14-m17-series/16647043].  P.S. I assume the reason for the height increase with the HP dimensions is if you need to open the cover. From videos etc, I don't think this is required in normal use, and although maybe the paper may stick up slightly when coming out, I don't think it does much. But I assume HP doesn't want people complaining if they stick the printer in a tiny hole, then can't lift the cover when the paper gets stuck or they need to replace the toner or whatever. Again, I assume the Samsung is similar.  Nil Einne (talk) 09:13, 13 January 2020 (UTC)
 * Thanks, I believe the driver on hp.com these days is the same as the one Samsung used to distribute. I haven't tried it yet due to the bad experiences I've seen some report of.  I'll write a little more about that tomorrow as it's late here (California) now and I'm only half awake.  It's true that feeding paper into the ML-2160 requires flipping out a tray, and there is also a flip-open cover to receive the output, but when everything is folded up the package is very compact.  The issue is that even if you use the binary blobs, the driver is very unreliable and tends to stop after a few pages.  If I can get the thing to work from a raspberry pi though, that would be great, I could just dedicate a pi to the printer and just not upgrade the software after that.  I'll look at the HLL2375DW too.  2601:648:8202:96B0:0:0:0:DF95 (talk) 10:09, 13 January 2020 (UTC)


 * Nil Einne, your link about the Brother HL-1210W is 404 and Newegg sells cartridges for it but not the printer itself. I suspect it uses the same mechanism as the Samsung ML-2160, and may be discontinued.  On another computer (not here) I have what I think is a Brother HL-L2350DW, although I'm a little confused since Newegg specs that as being a GDI (Windows) printer but I'm pretty sure it has built-in Postscript emulation.  I'll check it when I get a chance.  It works well with Linux and though it is bigger than the Samsung, it's still fairly small for a laser printer and its duplex feature is sometimes handy (though it slows down printing by quite a lot).  So I might just get another one.  The HL-L2375DW appears to be an NZ model.  Another idea might be to replace the Samsung with my existing Brother printer, and replace the Brother printer with one that can print in color, a capability I've sometimes wanted.  I may ask for advice about color printers in another post at some point.  Thanks! 2601:648:8202:96B0:0:0:0:DF95 (talk) 09:49, 14 January 2020 (UTC)

Notice: fwrite: write of 8192 bytes failed with errno=22 Invalid argument
Does anyone know wot this means? It's pointing to an error in this line of code. Many thanks, if anyone can help! —— SN  54129  17:18, 13 January 2020 (UTC)
 * You might get more help if you mentioned which language you are using. "code" could mean anything from assembly right up to SQL. Martin of Sheffield (talk) 17:43, 13 January 2020 (UTC)
 * Oh. Well, it's in a PHP file, so that? ——  SN  54129  18:06, 13 January 2020 (UTC)
 * By chance, is it running on OSX? 135.84.167.41 (talk) 18:11, 13 January 2020 (UTC)
 * If this is Windows, you may need to double-escape all backslashes (or just use normal slashes - PHP converts it for you). 135.84.167.41 (talk) 18:12, 13 January 2020 (UTC)
 * No W10—but thanks for the blackslash point, I read something like that elsewhere. But there isn't a slash on that particular line? ——  SN  54129  18:33, 13 January 2020 (UTC)


 * I'm just taking a wild guess, because I don't know this language, but you said that you are writing 8192 bytes, but the statement has a 65536 in it. Often this parameter is the number of bytes to be written.  Bubba73 You talkin' to me? 19:02, 13 January 2020 (UTC)
 * Have a look at the manual page.  I don't think length is the issue: "If the length argument is given, writing will stop after length bytes have been written or the end of string is reached, whichever comes first".   are you sure that you opened the file as binary?  See the note "On systems which differentiate between binary and text files (i.e. Windows) the file must be opened with 'b' included in fopen mode parameter".  If that isn't the answer, try without the 65556; it is an optional argument.  The result may be wrong/badly formatted, but it would identify if the third argument as the problem.  If it works with two parameters then you need to check up on $pipe, $buffers and $fd.  Did you check the status of the fopen? Martin of Sheffield (talk) 19:34, 13 January 2020 (UTC)


 * Errno 22 is EINVAL which on a write call usually means the address of the write buffer is invalid. I'm suspicious of the $buffers[$fd] parameter. Are you sure that that refers to a valid memory buffer that is at least 65536 bytes long? CodeTalker (talk) 21:24, 13 January 2020 (UTC)
 * It's more likely that  is "an object which is unsuitable for writing". Alternatively, if indeed   is only 8192 bytes, then write may run of the end of the buffer. Try   for the file descriptor, or a smaller value for the size to see which one breaks it. --Stephan Schulz (talk) 22:23, 13 January 2020 (UTC)
 * Remember that the manual quoted above allows for short writes: "writing will stop after length bytes have been written or the end of string is reached, whichever comes first". If $buffers[$fd] does not point to a valid string then there could be an input issue.  On the other hand $pipe needs to be valid or the output buffer will not be found. Martin of Sheffield (talk) 22:34, 13 January 2020 (UTC)
 * If $pipe were not a writable file descriptor, you would get errno 9 (EBADF) rather than EINVAL. This version of the Linux man page for write(2) says EINVAL can also happen if the "fd is attached to an object which is unsuitable for writing", which I guess is referring to having mmapped a read-only file, or if the file is opened with O_DIRECT and the buffer is misaligned, but hopefully the OP isn't using mmap or O_DIRECT. CodeTalker (talk) 22:56, 13 January 2020 (UTC)
 * (1) The OP is using the PHP fwrite function, the C write function is a good guide, but not infallible. (2) The OP is using Windows 10 so Linux man pages are a good guide, but again not infallible. (3) The PHP man page warns that under Windows the file needs to be opened as a binary file, something not applicable to Linux. Martin of Sheffield (talk) 23:21, 14 January 2020 (UTC)


 * That call can give that error code if $buffers[$fd] is not a valid string, or if something went wrong with the underlying write system call (unlikely). 108.29.38.53 (talk) 15:29, 16 January 2020 (UTC)