📜 ⬆️ ⬇️

How I did USB MFP wireless

Introduction

They say the child in school will need a color printer and scanner. Yes, and most wanted to change something for a collapsing black and white lazer 1996 release. The selection criteria were: chromaticity, laser technology (the intervals between printing can reach months), the automatic document feeder for scanners and copiers, automatic duplex printing and Wi-Fi to put this box in the far corner. According to these characteristics, some kind of huge object for 25+ kilorubles was selected, which seemed unreasonable. And suddenly, at work, they gave out a couple of gift cards from a well-known pink store, and the feeling came that you should buy. Unfortunately, his assortment contained only three laser MFPs with color printing, none of which met the last two requirements. Two months later, the assortment was not replenished by anything, but on the contrary, it was reduced to two positions all over Moscow, and I decided to take what was available and not on the shop window.

Lucky it turned out to be the HP Laserjet Pro 100 Color MFP M175a , without the automatic page rotation and with USB connection only. By the way, he was not as big as I expected, and not as noisy as they say in the reviews.

Task

If automatic duplex printing is almost impossible to add to the printer, it is quite realistic to untie it from the computer.

A simple but unsuitable way is to connect it to the router that distributes the Internet in the apartment and, possibly, has a USB port. This method implies that, firstly, the MFP will have to stand in a three-meter range from the router, and secondly, the router will only allow printing, not scanning too (on factory firmware).
')
The second way is to buy a box for $ 35 ... ... and hope that it will be able to do what is needed, and suddenly it will be compatible with Ubuntu on the client side. The representative of the manufacturer willingly answers something unintelligible in wonderful Chinese English. I did not hope for good luck.

The third method, already valid, allows you to use a device connected via USB to one computer on another computer as if it is connected to the second, using at least a local network, even the Internet.

Soft

There are several implementations, but I immediately chose the one that is included in the Linux kernel in order to save myself from any possible licensing restrictions, payments, the inability to configure something and other dependencies in advance. Called usbip.

Iron

It was possible to find an old D-Link in the closet, to hoist OpenWRT on it, but that would be cumbersome and with a small share of their own hands, so it was decided to look for something small, omnipotent and inexpensive.

Carambola
The size of a matchbox, has on board Wi-Fi, USB-host, 320 MHz MIPS-processor, consumes no more than 1.5W, OpenWRT OS, costs 22 euros.

Raspberry pi
size 86x56, Wi-Fi will have to buy an external one and plug it into a USB, 700 MHz processor, a lot of what will not be used on the board consumes at least 3.5W ( 700mA at 5V ), Linux costs 35 USD to choose from.

A13-OLinuXino-WIFI
size 120x120, 1 GHz ARM-processor, rich peripherals, Linux OS, consumes 4.2W ( 350mA at 12V ), costs 55 euros.

Cubieboard and its Chinese counterparts
Similar to the previous version.

ALIX by PC Engines
My long-time favorite, the size is 100x160 or 152x152,500 MHz. The i386 processor, without built-in Wi-Fi, almost any OS consumes 5W, costs from 64 to 78 euros.

As a result, according to the size-energy consumption-cost criteria, taking into account the sufficiency of functions, the first option was chosen - Carambola.

Process

Since it was planned to connect only USB and power, there was no need for a development board and case, only the module itself was ordered.

The console is detected on the TXD2-RXD2, 115000 8N1.
For USB to work in host mode, pin 21 must be connected to 5V (the module itself only works at 3.3V), and pin 40 must be connected to GND. White wire (D +) to pin 39, green (D-) - to 38.
The manufacturer reported that the data lines of the USB cable can be connected to the module directly, the Internet prompted that in this case it is better not to use the hot plug, that is, connect-disconnect USB devices with the module de-energized. It suits me - I'm going to connect the MFP once and for all.
OpenWRT was preinstalled with one of the long-standing Bleeding Edge, I immediately updated it to a stable 12.09 Attitude Adjustment via the web interface.
Then, the usbip package was installed in OpenWRT, which pulled the necessary kernel modules and utilities behind it. It remains to add a couple of lines in autoload:
/usr/sbin/usbipd -D /usr/sbin/usbip bind --busid=1-1 
“1-1” I took from the output of the list of connected USB devices in the OpenWRT console:
 usbip list -l 

On the client side of Ubuntu 13.10. Kernel modules are present in the system, to automatically boot them you need (usbip_core, vhci_hcd) to add to /etc/modules
Userspace utilities, however, are missing. You should not install them from repositories, there is version 0.1.7-3, there will be no work with version 1.1.1 on OpenWRT. You can do this as follows:
 sudo apt-get install linux-sources tar -jxf /usr/src/linux-source-3.11.0/linux-source-3.11.0.tar.bz2 cd drivers/staging/usbip/userspace/ ./autogen.sh ./configure make sudo make install 
Now, to connect the MFP, I just need to run
 sudo usbip attach --remote=192.168.2.16 --busid=1-1 

disadvantages

The main disadvantage is that the connection between the usbip server and the usbip client is a one-to-one connection, that is, if one client has connected a USB device to the server, others can no longer connect it until it is disconnected first. For such a case, you can tense up and write a usbip management page in the OpenWRT web interface, but for now it does not threaten me, the MFP will be used only from one workplace.
Another disadvantage is that, theoretically, the speed of the link via Wi-Fi is less than the USB cable, but in my particular case, the scan data is slower through the cable, but this is probably my local problem.

Future plans

Now the module is powered by a 12V to 5V and 3.3V DC converter:

He is bulky and would take a separate matchbox himself. It is being replaced by a DC-converter 5V to 3.3V from China, like this:

He is quite a baby and will fit in one matchbox with Carambola (without pins). All this will be powered by an old phone charger.
The ultimate dream is to place this box inside the MFP housing, suddenly there will be a spot there, but find inside it a 5V source, or at least another place under the converter with AC 220V. But this I decide only after the end of the warranty repair.

Development and Testing:


(The colors of the power wiring are arbitrary)

Result

Two days after writing the topic, the voltage converter arrived from China more quickly than ever (in a couple of weeks instead of the usual four or five), now the project is completed:

Add-on to the OpenWRT web interface for freeing the USB device: disik.ru/uploads/luci-usbip.tar.gz

Source: https://habr.com/ru/post/216177/


All Articles