Making Canon LBP6000 printer work under Ubuntu 14.04 64-bit
Solution 1
I followed Masroor/bain instructions; after installing EVERY SINGLE (hidden) DEPENDENCY, I was able to get it to work, but ran into the "kill ccpd once every boot" issue.
If you go here and look at the very end of the page, they say:
Only one ccpd process running after system startup For normal operation two ccpd processes should be running in a system. The ccpd daemon depends on running cups daemon before forking the second process. You can use the following method to workaround the problem:
Enable the cups init script (update-rc.d cups defaults).
Instruct the ccpd init script to run after the cups init (update-rc.d ccpd defaults 99), or add "sleep 10 && /etc/init.d/ccpd start" in /etc/rc.local script.
I removed all runlevels for ccpd and added the sleep command to rc.local.
Solution 2
Here are scripts that helped me with LBP6000, however it is in russian.
http://help.ubuntu.ru/wiki/canon_capt
There is a downloads section on the page. Then you choose printer model and install it. You'll probably better use translator, but it is worth it.
Related videos on Youtube
Tim Duncklee
Updated on September 18, 2022Comments
-
Tim Duncklee over 1 year
I'm trying to do the bare minimum, just to get it working.
Here is my Google Script:function doPost(e) { return ContentService.createTextOutput(JSON.stringify(e.parameter)); }
Here is my PHP code:
$url = 'https://script.google.com/a/somedomain.com/macros/s/### script id ###/exec'; $data['name'] = "Joe"; $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: multipart/form-data")); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data)); // curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); $result = curl_exec($ch); $error = curl_error($ch);
Executing this,
$result
istrue
.If I uncomment the
CURLOPT_RETURNTRANSFER
line,$result
=<HTML> <HEAD> <TITLE>Bad Request</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000"> <H1>Bad Request</H1> <H2>Error 400</H2> </BODY> </HTML>
$error
is always empty.I would use
doGet()
but I need to send some rather large POSTs that will exceed what GET can handle.How can I post to a Google script and return data?
------ UPDATE ------
I've just learned my lead developer tried this some time ago and concluded doPost() errors when returning so apparently it's not just me. My take is that Google is simply not reliable enough to use. I would love for someone to prove me wrong.
------ UPDATE 2 - THE FIX ---------
Apparently this was the problem:
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
needs to be:
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
No idea why
http_build_query()
caused it to error.-
bain almost 10 yearsSee my answer to Can't get my Canon LBP printer to run under Ubuntu 14.04
-
Masroor almost 10 years@bain Your suggested method worked. Flawlessly. Also, your answer is full of insights. This was particularly delightful. Perhaps you can answer the observations at the end of my UPDATE 2.
-
Misunderstood over 6 yearsMy guess would be the
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-type: multipart/form-data"));
was the culprit. This should not have been needed. CURL would put the proper type the header itself based on the post data being a query string or an array. It may work with the query string without this header option. -
Misunderstood over 6 yearsWhen a query string is used the header should be:
application/x-www-form-urlencoded
When an array the header should be:multipart/form-data
-
-
Masroor almost 7 yearsGot rid of that annoying printer. But thanks anyway.
-
Tim Duncklee over 6 yearsSorry for the confusion. I'm not trying to post a file. Just text. I've updated the question for clarity.
-
S. Imp over 6 years@TimDuncklee I edited my post to provide a little more info. Unfortunately there's not much else you can do beyond what I've posted here. If you are getting "Bad Request" then you need to find out from the API or the API docs what you are doing wrong.
-
Tim Duncklee over 6 yearscurl_getinfo($ch) returns nothing. I think Google is simply not reliable enough to use. It is random but I can sometimes do the same with a doGET() but often it returns an error also. Run the exact same code a while later with NO changes to the code and it works. What I'm trying to do is trivial and I've done this many times outside of Google. It should not be this difficult.
-
S. Imp over 6 yearsthat's pretty weird that curl_getinfo returns nothing. Do you mean FALSE, the empty string, zero, or NULL?
-
Tim Duncklee over 6 yearscurl_getinfo returns null with and without CURLOPT_RETURNTRANSFER set. I do believe this is a google bug. With CURLOPT_RETURNTRANSFER set curl_exec() returns html with the Bad Request in <h1> tags so I think curl is succeeding. It's Google sending the error.
-
Misunderstood over 6 years@TimDuncklee Not likely it's a Google error. Most likely there is something wrong with passed parameters based on the returned bad request message.
-
S. Imp over 6 yearsTry reading the entire text of the Bad Request response and you may actually find a useful error message.
-
S. Imp over 6 yearsAlso, I find it really hard to believe that curl_getinfo returns NULL if you are using it correctly. You should be calling this function after you call curl_exec.
-
Tim Duncklee over 6 years@S. Imp I have pasted the entire error message in my question. I am calling curl_getinfo($ch); immediately after curl_exec($ch);
-
Tim Duncklee over 6 yearsThank you. Your post. It got me looking in the right direction. I've updated my question with the fix.
-
S. Imp over 6 years@TimDuncklee I see from your updates that you never actually tried my code because I had removed the http_build_query bit. I also see from the response code that you posted that the response says it returned a response code of 400. I find it puzzling that curl_getinfo would return NULL in this case, but haven't seen the exact code (or exact url) that you are calling.
-
Tim Duncklee over 6 years@S. Imp I did not try your code because I was not trying to upload a file. curl_getinfo was returning valid info. It was my fault. I did not notice I was overwriting the returned value by the time I hit my breakpoint. Thank you for your help!