0

IoT Raspberry Pi printer driver issue
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

IoT Raspberry Pi printer driver issue

by el10t on Sun Aug 04, 2019 2:24 pm

Hi all - after about 6 or 7 years I'm trying to get my old IoT Raspberry Pi thermal printer working again. The instructions on software setup seem to have changed since I last set it up but I've followed them all at https://learn.adafruit.com/pi-thermal-p ... ware-setup

However, when it comes to installing the printer drivers I have a problem, After the 'make' command it throws up a bunch of deprecated file warnings and then a final error (see below). Any solutions? Have I missed something?

Thanks all

Code: Select all | TOGGLE FULL SIZE
.c:109:2: warning: ‘ppdFindMarkedChoice’ is deprecated: Use cupsCopyDestInfo and friends instead. [-Wdeprecated-declarations]
  choice = ppdFindMarkedChoice(ppd, choiceName);
  ^~~~~~
In file included from rastertozj.c:4:
/usr/include/cups/ppd.h:385:22: note: declared here
 extern ppd_choice_t *ppdFindMarkedChoice(ppd_file_t *ppd,
                      ^~~~~~~~~~~~~~~~~~~
rastertozj.c:113:3: warning: ‘ppdFindOption’ is deprecated: Use cupsCopyDestInfo and friends instead. [-Wdeprecated-declarations]
   if ((option = ppdFindOption(ppd, choiceName))          == NULL) return -1;
   ^~
In file included from rastertozj.c:4:
/usr/include/cups/ppd.h:388:22: note: declared here
 extern ppd_option_t *ppdFindOption(ppd_file_t *ppd, const char *keyword)
                      ^~~~~~~~~~~~~
rastertozj.c:114:3: warning: ‘ppdFindChoice’ is deprecated: Use cupsCopyDestInfo and friends instead. [-Wdeprecated-declarations]
   if ((choice = ppdFindChoice(option,option->defchoice)) == NULL) return -1;
   ^~
In file included from rastertozj.c:4:
/usr/include/cups/ppd.h:383:22: note: declared here
 extern ppd_choice_t *ppdFindChoice(ppd_option_t *o, const char *option)
                      ^~~~~~~~~~~~~
rastertozj.c: In function ‘initializeSettings’:
rastertozj.c:127:2: warning: ‘ppdOpenFile’ is deprecated: Use cupsCopyDestInfo and friends instead. [-Wdeprecated-declarations]
  ppd = ppdOpenFile(getenv("PPD"));
  ^~~
In file included from rastertozj.c:4:
/usr/include/cups/ppd.h:397:20: note: declared here
 extern ppd_file_t *ppdOpenFile(const char *filename) _PPD_DEPRECATED;
                    ^~~~~~~~~~~
rastertozj.c:129:2: warning: ‘ppdMarkDefaults’ is deprecated: Use cupsCopyDestInfo and friends instead. [-Wdeprecated-declarations]
  ppdMarkDefaults(ppd);
  ^~~~~~~~~~~~~~~
In file included from rastertozj.c:4:
/usr/include/cups/ppd.h:392:14: note: declared here
 extern void  ppdMarkDefaults(ppd_file_t *ppd) _PPD_DEPRECATED;
              ^~~~~~~~~~~~~~~
rastertozj.c:134:3: warning: ‘cupsMarkOptions’ is deprecated: Use cupsCopyDestInfo and friends instead. [-Wdeprecated-declarations]
   cupsMarkOptions(ppd, numOptions, options);
   ^~~~~~~~~~~~~~~
In file included from rastertozj.c:4:
/usr/include/cups/ppd.h:370:13: note: declared here
 extern int  cupsMarkOptions(ppd_file_t *ppd, int num_options, cups_option_t *options) _PPD_DEPRECATED;
             ^~~~~~~~~~~~~~~
rastertozj.c:145:2: warning: ‘ppdClose’ is deprecated: Use cupsCopyDestInfo and friends instead. [-Wdeprecated-declarations]
  ppdClose(ppd);
  ^~~~~~~~
In file included from rastertozj.c:4:
/usr/include/cups/ppd.h:372:14: note: declared here
 extern void  ppdClose(ppd_file_t *ppd) _PPD_DEPRECATED;
              ^~~~~~~~
rastertozj.c: At top level:
rastertozj.c:87:16: warning: ‘rasterModeStartCommand’ is static but used in inline function ‘rasterheader’ which is not static
  outputCommand(rasterModeStartCommand);
                ^~~~~~~~~~~~~~~~~~~~~~
gcc  -o rastertozj rastertozj.o -lcupsimage -lcups
/usr/bin/ld: rastertozj.o: in function `main':
rastertozj.c:(.text.startup+0x4c): undefined reference to `initializeSettings'
collect2: error: ld returned 1 exit status
make: *** [Makefile:13: rastertozj] Error 1

el10t
 
Posts: 5
Joined: Sun Aug 04, 2019 2:19 pm

Re: IoT Raspberry Pi printer driver issue

by adafruit_support_carter on Mon Aug 05, 2019 12:49 pm

There are two things happening. The warnings are being generated by use of functions that have been marked as deprecated. The error has something to do with differences in treatment of inline declarations with gcc.

Assuming the deprecated functions are still usable, try this to get around the error related to inline. Edit the Makefile and change the flags to:
Code: Select all | TOGGLE FULL SIZE
CFLAGS=-Wl,-rpath,/usr/lib -Wall -fPIC -O3 -std=gnu89

Delete the .o file and run make again.

adafruit_support_carter
 
Posts: 13218
Joined: Tue Nov 29, 2016 2:45 pm

Re: IoT Raspberry Pi printer driver issue

by el10t on Mon Aug 05, 2019 1:07 pm

Fabulous! Many thanks for that - it worked (or compiled at least)

I now have a second problem. The printertest.py script works fine and prints all the different text formats up to the point where it tries to print the barcode example. At that point the pi reboots itself. All very weird.

el10t
 
Posts: 5
Joined: Sun Aug 04, 2019 2:19 pm

Re: IoT Raspberry Pi printer driver issue

by adafruit_support_carter on Mon Aug 05, 2019 1:19 pm

That sounds power related. The current draw is probably the highest for the barcode since it has large areas of black. So you aren't hitting the power issue until that point.

What's your power setup? What's powering the printer and the Pi?

adafruit_support_carter
 
Posts: 13218
Joined: Tue Nov 29, 2016 2:45 pm

Re: IoT Raspberry Pi printer driver issue

by el10t on Mon Aug 05, 2019 1:37 pm

Aha! I should have thought of that. That's almost certainly it - many thanks. At the moment I'm powering it from the official raspberry Pi mini USB power adapter, through the mini USB port. Fine for the Pi but not with the printer to power as well.

I've got the barrel connector all wired in and ready to go and am expecting a 5v 2amp supply in the post tomorrow. I'll let you know how it goes. Thanks again.

el10t
 
Posts: 5
Joined: Sun Aug 04, 2019 2:19 pm

Re: IoT Raspberry Pi printer driver issue

by el10t on Tue Aug 06, 2019 2:07 pm

Just to close this one off - the power issue was correct! A meatier power supply and all is good in the world. Thank you so much!

el10t
 
Posts: 5
Joined: Sun Aug 04, 2019 2:19 pm

Re: IoT Raspberry Pi printer driver issue

by adafruit_support_carter on Tue Aug 06, 2019 2:12 pm

Cool. Thanks for letting us know.

adafruit_support_carter
 
Posts: 13218
Joined: Tue Nov 29, 2016 2:45 pm

Please be positive and constructive with your questions and comments.