Live data from Hacker News

WebAssembly+WebUSB port of the SANE scanner library

github.com

11–20 of 27 posts

Re: WebAssembly+WebUSB port of the SANE scanner library

#11

IMO one of the biggest opportunities for WASM is printer and scanner drivers. These things have historically been distributed as native code, so the usability of the hardware on various OSes and architectures is spotty[0]. WASM is close enough to a native binary (fast, not source[1]) to be accepted by hardware vendors, but is inherently architecture-independent and in principle could be built to an OS-indendent API.…

I was just asking about this in a thread about a driver for an old webcam here yesterday! [0] Absolutely agreed, it really seems like a fascinating possibility. What’s your take on how WASM drivers (meant to run in a web browser) could integrate at the OS level? For instance, if you wanted all installed desktop softwares to be able to print via the WASM printer driver? [0] https://news.ycombinator.com/item?id=3574565…

I don't see any reason why wasm can't just become another native format.

wasm spec is fully defined and public, and we even already have source for browsers.

What prevents developing a wrapper or shim that runs any wasm as if it were any other native executable?

You might be legally prevented from redistributing the wasm, so maybe you can't bundle it right into a .deb or.rpm, but it's trivial in that case to just download on the fly if not exist and re-use after that. You may want it to check for updates all the time anyway.

Re: WebAssembly+WebUSB port of the SANE scanner library

#12

Earlier quoted context omitted.

I was just asking about this in a thread about a driver for an old webcam here yesterday! [0] Absolutely agreed, it really seems like a fascinating possibility. What’s your take on how WASM drivers (meant to run in a web browser) could integrate at the OS level? For instance, if you wanted all installed desktop softwares to be able to print via the WASM printer driver? [0] https://news.ycombinator.com/item?id=3574565…

I don't see any reason why wasm can't just become another native format. wasm spec is fully defined and public, and we even already have source for browsers. What prevents developing a wrapper or shim that runs any wasm as if it were any other native executable? You might be legally prevented from redistributing the wasm, so maybe you can't bundle it right into a .deb or.rpm, but it's trivial in that case to just dow…

> What prevents developing a wrapper or shim that runs any wasm as if it were any other native executable?

That definitely exists and is used on server-side - Wasmtime, Wasmer and others.

Re: WebAssembly+WebUSB port of the SANE scanner library

#13

IMO one of the biggest opportunities for WASM is printer and scanner drivers. These things have historically been distributed as native code, so the usability of the hardware on various OSes and architectures is spotty[0]. WASM is close enough to a native binary (fast, not source[1]) to be accepted by hardware vendors, but is inherently architecture-independent and in principle could be built to an OS-indendent API.…

So you feel that e.g. Epson, who could not be bothered to rebuild their existing C-ish driver against a newer version of libc, will instead port it to WASM because ... when they already have working drivers for macOS and Windows that they currently maintain ....

I'm lost.

Re: WebAssembly+WebUSB port of the SANE scanner library

#14

Earlier quoted context omitted.

I was just asking about this in a thread about a driver for an old webcam here yesterday! [0] Absolutely agreed, it really seems like a fascinating possibility. What’s your take on how WASM drivers (meant to run in a web browser) could integrate at the OS level? For instance, if you wanted all installed desktop softwares to be able to print via the WASM printer driver? [0] https://news.ycombinator.com/item?id=3574565…

I don't see any reason why wasm can't just become another native format. wasm spec is fully defined and public, and we even already have source for browsers. What prevents developing a wrapper or shim that runs any wasm as if it were any other native executable? You might be legally prevented from redistributing the wasm, so maybe you can't bundle it right into a .deb or.rpm, but it's trivial in that case to just dow…

It's typically called a VM. Go up and read about Java, which was fundamentally premised on precisely the same idea, and then see if you can come with some clear reasons why wasm should/will be more successful.

Re: WebAssembly+WebUSB port of the SANE scanner library

#15

IMO one of the biggest opportunities for WASM is printer and scanner drivers. These things have historically been distributed as native code, so the usability of the hardware on various OSes and architectures is spotty[0]. WASM is close enough to a native binary (fast, not source[1]) to be accepted by hardware vendors, but is inherently architecture-independent and in principle could be built to an OS-indendent API.…

So you feel that e.g. Epson, who could not be bothered to rebuild their existing C-ish driver against a newer version of libc, will instead port it to WASM because ... when they already have working drivers for macOS and Windows that they currently maintain .... I'm lost.

If the standard for Linux scanner drivers was WASM, then companies who publish Linux drivers (such as Epson) would receive perfect forward compatibility for free.

If WASM driver support were to be included in Windows and/or macOS, similar to how macOS and Linux share CUPS, then Linux support would be more widespread because the vendor's driver could be reused as-is.

I think the thought process behind "supporting one unified platform-independent bytecode would be easier than compiling a .so that works with all GNU libc versions" is straightforward and self-evident. Do you disagree?

Re: WebAssembly+WebUSB port of the SANE scanner library

#16

IMO one of the biggest opportunities for WASM is printer and scanner drivers. These things have historically been distributed as native code, so the usability of the hardware on various OSes and architectures is spotty[0]. WASM is close enough to a native binary (fast, not source[1]) to be accepted by hardware vendors, but is inherently architecture-independent and in principle could be built to an OS-indendent API.…

If only there were some kind of language that could compile to a code that could be run on any operating system that could be used for this sort of thing. Oh wait, it's Java and it's been around for 25 years. But quite restricted in it's interaction with the OS, for good reason. As is WASM, for good reason as well. If printer drivers in Java didn't become a thing, I doubt that WASM printer drivers will.

Though I can't really understand why a printer driver needs such low level OS access so as to become a security risk as they sometimes are - aren't they basically a program that converts one image format to another, then flings that down a USB or network port?

Re: WebAssembly+WebUSB port of the SANE scanner library

#17
This is interesting, however to pour a bit of water on the opportunities here:

- CUPS has existed for over 20 years

- Java has existed for over 25 years

However, I still not use CUPS or similar systems on Windows. And Java-based (or other VM-based) printer drivers have never been a thing AFAIK, on any platform.

There are however platform independent device support at a lower level, e.g. OpenFirmware and EFI. This is usually not leveraged post-boot.

Re: WebAssembly+WebUSB port of the SANE scanner library

#19

I just purchased a Chromebook, and it won't detect the scanner of my HP multifunction. Is this software my salvation?

This is the list of possible supported devices right now (USB only):

http://www.sane-project.org/sane-backends.html

But HP is a special case, they provide their own backend (hpaio, open-source) for SANE that is not integrated into sane-wasm ATM.

http://www.sane-project.org/lists/sane-backends-external.htm...

If your device is on this list, it's NOT supported right now! But I do want to add hpaio soon, I also have access to an OfficeJet to test.

Re: WebAssembly+WebUSB port of the SANE scanner library

#20

IMO one of the biggest opportunities for WASM is printer and scanner drivers. These things have historically been distributed as native code, so the usability of the hardware on various OSes and architectures is spotty[0]. WASM is close enough to a native binary (fast, not source[1]) to be accepted by hardware vendors, but is inherently architecture-independent and in principle could be built to an OS-indendent API.…

If only there were some kind of language that could compile to a code that could be run on any operating system that could be used for this sort of thing. Oh wait, it's Java and it's been around for 25 years. But quite restricted in it's interaction with the OS, for good reason. As is WASM, for good reason as well. If printer drivers in Java didn't become a thing, I doubt that WASM printer drivers will. Though I can'…

WASM is not a language though, the equivalent here would be a JVM, but that enforces all sorts of Java specific constraints that you do not want in a driver.

The short answer to your question is: No.

Post reply on HN