slackraspi
Posts: 4
Joined: Thu Dec 26, 2013 11:05 am

correct power

Thu Dec 26, 2013 11:28 am

hi everybody and Happy Christmas!
I've successfully installed a slackware 14.1 on a raspberry pi type B and I want to connect a laserjet printer p1005 to it in order to share the printer over my lan. :D The software I want to use is CUPS and the driver is the foo2zjs downloaded from http://foo2zjs.rkkda.com/
Everything seems to be properly configured but I can only manage to print for a few minutes then the printer stops with the following log (repeated forever)

darkstar kernel: usb 1-1.2: usbfs: process 776 (usb) did not claim interface 0 before use

I have one doubt: to give power to the raspberry I'm using a power charger by Asus whose output is 5v - 2A? Is it enough?
I have also used another power charger (by Samsung) whose output is 5v 0.7A, but with it the printer doesn't print at all.
Someone wrote me that it is all because the raspberry has got unreliable usb connections?
Can anybody help me find a solution? :?:
Thank you

PS (I have been using the same settings with an old 386 - but it consumed too much electricity)

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5643
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: correct power

Thu Dec 26, 2013 2:15 pm

slackraspi wrote:hi everybody and Happy Christmas!
I've successfully installed a slackware 14.1 on a raspberry pi type B and I want to connect a laserjet printer p1005 to it in order to share the printer over my lan. :D The software I want to use is CUPS and the driver is the foo2zjs downloaded from http://foo2zjs.rkkda.com/
Everything seems to be properly configured but I can only manage to print for a few minutes then the printer stops with the following log (repeated forever)
darkstar kernel: usb 1-1.2: usbfs: process 776 (usb) did not claim interface 0 before use
I have one doubt: to give power to the raspberry I'm using a power charger by Asus whose output is 5v - 2A? Is it enough?
I have also used another power charger (by Samsung) whose output is 5v 0.7A, but with it the printer doesn't print at all.
Someone wrote me that it is all because the raspberry has got unreliable usb connections?
Can anybody help me find a solution? :?:
Thank you
PS (I have been using the same settings with an old 386 - but it consumed too much electricity)
W.r.t. PSU "power" - the 5V 2A PSU should be fine, so long as it's only powering the Pi (and, perhaps, an external "powered hub"), ie. I'm assuming the printer has its own power source. The Samsung 5V 0.7A PSU, however, is almost certainly "not good enough" - a model B Pi needs a 5V supply that can still supply >4.75 V at ~800 - 1000mA (depending upon what is plugged into the USB ports).
Beside the printer(?), what (else) do you have plugged into the USB ports?
As I haven't used any laserjet printers, I can't comment in any detail w.r.t. your log messages (although I have used CUPS to print to an old Canon BJC250 via a USB-to-parallel-port/printer cable, and to a wireless-networked HP printer/scanner combi.)
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

slackraspi
Posts: 4
Joined: Thu Dec 26, 2013 11:05 am

Re: correct power

Thu Dec 26, 2013 2:28 pm

Thank you for your prompt reply.
No there isn't anything else attached to the raspberry pi (with the exception of the ethernet cable, of course). I bought it because I wanted to solve the problem of sharing one printer and keeping it always on.
The power charger works well (because I use it to recharge the asus tablet pc and it gives no problems).
I have also tried the raspbian distribution (using the same driver for the printer, I compile it from source) but Slackware arm works better (at least in this case) because the printer prints -- at the beginning -- and it prints quickly.
Thanks again and Happy New Year.

User avatar
FLYFISH TECHNOLOGIES
Posts: 1750
Joined: Thu Oct 03, 2013 7:48 am
Location: Ljubljana, Slovenia
Contact: Website

Re: correct power

Thu Dec 26, 2013 3:00 pm

Hi,
slackraspi wrote:I have one doubt: to give power to the raspberry I'm using a power charger by Asus whose output is 5v - 2A? Is it enough?
For supplying both devices, probably yes (from mathematical sum perspective).. but the point is elsewhere... There is a current limit RasPi can provide through USB ports.

Some general text first...
"Bigger" USB devices can sink such a high amount of current, that is even above USB specification limit. For example, I have a scanner which requires 700mA, where the current limit set by USB 2.0 standard is 500mA for higher loads and 100mA for a group of smaller loads. Therefore, this my scanner is not USB 2.0 compliant, despite the fact that it is made by a very known and respected company. The reason is obviously in competition pressure (to reduce cost by not providing additional power supply and to be more user-friendly by having just USB cable).

One of the lack of the USB ports is a discrete current limiter, which would reject loads sinking currents higher than 500mA/100mA, since the device exceeding this amount of current is not USB-compliant. Instead, USB ports have just "soft" current limiter - during USB enumeration procedure the USB device "introduces" itself also with data about maximum current it "intends" to sink from USB port. If it has stand-alone power supply, then this value is 0. Many vendors cheat here, because they set this software value to 500mA or 100mA (or even to 0) despite the fact that the actual value is higher (like for my scanner). If the actual value would be revealed, then each and every computer would have to reject this device.
Since most computers don't have proper USB current detecting/limiting elements, this "introduction" is the only data they can rely on... and due to some safety margin on the computers, these USB devices can usually operate normally. (Laptops can cause some troubles to those cheaters and you can read various messages in many forums that USB device X doesn't work on laptop Y... but the problem is typically not in the laptop.)

Going back to the RasPi specifics, it has a current-limiting element, which can cut the power if the current exceeds maximum overall value. You can search here for "polyfuse" word for details.
I mentioned above about two maximum currents applicable to USB 2.0. They can be 500mA or 100mA. Each hardware vendor decides what are the capabilities of the particular product's USB port. For the RasPi, the team has decided to desin the board for 100mA USB devices (keyboards, mouses, etc., including all USB devices with their own power supplies).
slackraspi wrote:I have also used another power charger (by Samsung) whose output is 5v 0.7A, but with it the printer doesn't print at all.
700mA is enough current for RasPi model A (without any attached device). I'd not supply model B with this power supply.
slackraspi wrote:Someone wrote me that it is all because the raspberry has got unreliable usb connections?
You should forward him/her a link to this message. ;-)
As mentioned above, RasPi was designed to support only 100mA USB devices.
slackraspi wrote:Can anybody help me find a solution?
People usually add powered USB hub, which then provides required current.

If your printer doesn't have a dedicated power supply, another option is to "inject" the power into the USB cable. Some people are performing back-powering of RasPi from USB, but this flow skips mentioned fuse and I don't recommend it.
What you could do is to take Asus supply and split power cord onto two paths - connect first one to the related RasPi power connector and the other one to supply the printer.


Best wishes, Ivan Zilic.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32

slackraspi
Posts: 4
Joined: Thu Dec 26, 2013 11:05 am

Re: correct power

Thu Dec 26, 2013 6:19 pm

Sorry I've given the idea that the printer has no dedicated power supply, which is not so--> laserjet p1005 has its own independent power supply.
By all the answers you have given I understand that the asus charger (5v 2A), which I use to give power only to the raspberry, should be enough.
So the possible error can only be in a problem with the printer driver (perhaps it was not thought for an arm cpu?) or in the usb device driver (of which I know very little).
Thank you everybody.
Luigi

slackraspi
Posts: 4
Joined: Thu Dec 26, 2013 11:05 am

Re: correct power

Thu Oct 30, 2014 8:00 pm

A lot of time has passed but I think it's worth while updating this discussion because I've found an answer and a solution to the problem. But first of all I have to say that it was not a problem created by raspberry pi nor by its usb ports.

It seems that the driver I use (foo2xqx) for my printer (hp laserjet p1005) loads the firmware to the printer through the script hplj1000. The script
1) looks for a printer device (/dev/usblp in my case);
2) transfers the firmware to the device.

Where is the problem? CUPS 1.4 requires that usblp be blacklisted (otherwise you cannot print anything).

So I needed usblp to load the firmware (otherwise the driver is useless), but CUPS doesn't want usblp!!!!

The simple workaround I found googling and experimenting is
1) load usblp on booting (no blacklisting) while the printer is switched on;
2) modprobe -r usblp soon after the firmware has been loaded (I have it in rc.local);

The printer prints out marvellously and serves seven computers with no problem.

Alleluja!!!
Luigi

W. H. Heydt
Posts: 12783
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: correct power

Thu Oct 30, 2014 9:10 pm

slackraspi wrote: Where is the problem? CUPS 1.4 requires that usblp be blacklisted (otherwise you cannot print anything).
From the context, I think you mean that usblp needs to be whitelisted (that is, usage is explicitly permitted) rather than blacklisted (usage is barred).

Return to “General discussion”