Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2015-10

Printing on Raspberry Pi

10 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Leonardo M. Ramé
to Koenraad Lelong

El 29/10/15 a las 12:24, Koenraad Lelong escribi?:

Show quoted text 17 lines
Hi, I'm trying to print a lazreport on a Raspberry Pi2. It's not working, I get : Bus Error or misaligned data access Press OK to ignore ... Pressing OK does nothing. Any suggestions to solve this ? I also tried the example from http://wiki.lazarus.freepascal.org/Using_the_printer. On my x86 linux-machine this works, on the RPi, nothing happens. Koenraad.

Hi Koenraad, can you print using the RPi from other applications?.

Regards,
Leonardo.

Reply by email

Koenraad Lelong
to Leonardo M. Ramé

Op 30-10-15 om 09:51 schreef Leonardo M. Ram?:

Show quoted text 23 lines
El 29/10/15 a las 12:24, Koenraad Lelong escribi?: > Hi, > > I'm trying to print a lazreport on a Raspberry Pi2. > It's not working, I get : > Bus Error or misaligned data access > Press OK to ignore ... > > Pressing OK does nothing. > > Any suggestions to solve this ? > > I also tried the example from > http://wiki.lazarus.freepascal.org/Using_the_printer. On my x86 > linux-machine this works, on the RPi, nothing happens. > > Koenraad. > Hi Koenraad, can you print using the RPi from other applications?. Regards, Leonardo.

Hi Leonardo,

Yes I can print. The cups-testpage certainly works. I also tried with libreoffice, works fine.
But leafpad has a problem. It generates a job in cups, but nothing comes out of the printer.

Koenraad

Reply by email

Anthony Tekatch
to Koenraad Lelong
Show quoted text 5 lines
I'm trying to print a lazreport on a Raspberry Pi2. It's not working, I get : Bus Error or misaligned data access Press OK to ignore ... Pressing OK does nothing.

I had a Lazarus printing problem because of unwritable ~/tmp .

Are the /tmp and ~/tmp directories writable by your user account and application?

Reply by email

Koenraad Lelong
to Anthony Tekatch

Op 01-11-15 om 18:08 schreef Anthony Tekatch:

Show quoted text 6 lines
> I'm trying to print a lazreport on a Raspberry Pi2. > It's not working, I get : > Bus Error or misaligned data access > Press OK to ignore ... > Pressing OK does nothing.

I managed to get Lazarus running on my Odroid-C1 so I can debug. When running the application, and trying to print it gives the error in LR_Prntr :

  // printer sizes
  with PaperSize.PaperRect do begin
   PPgw := PhysicalRect.Right-PhysicalRect.Left;
   Ppgh := PhysicalRect.Bottom-PhysicalRect.Top;
   POFx := WorkRect.Left;
   POFy := WorkRect.Top;
   PPw  := WorkRect.Right-WorkRect.Left; // this is the same as PageWidth
   PPh  := WorkRect.Bottom-WorkRect.Top; // this is the same as PageHeight
  end;
  // screen sizes
  Pgw := round(PPgw * kx);   <----- error, line 1042
  Pgh := round(PPgh * ky);
  Ofx := round(POfx * kx);
  Ofy := round(POfy * ky);
  Pw  := round(PPw  * kx);
  Ph  := round(PPh  * ky);

Reply by email

Koenraad Lelong
to Koenraad Lelong

Op 05-11-15 om 11:30 schreef Koenraad Lelong:

Show quoted text 29 lines
Op 01-11-15 om 18:08 schreef Anthony Tekatch: >> I'm trying to print a lazreport on a Raspberry Pi2. >> It's not working, I get : >> Bus Error or misaligned data access >> Press OK to ignore ... >> Pressing OK does nothing. > I managed to get Lazarus running on my Odroid-C1 so I can debug. When running the application, and trying to print it gives the error in LR_Prntr : // printer sizes with PaperSize.PaperRect do begin PPgw := PhysicalRect.Right-PhysicalRect.Left; Ppgh := PhysicalRect.Bottom-PhysicalRect.Top; POFx := WorkRect.Left; POFy := WorkRect.Top; PPw := WorkRect.Right-WorkRect.Left; // this is the same as PageWidth PPh := WorkRect.Bottom-WorkRect.Top; // this is the same as PageHeight end; // screen sizes Pgw := round(PPgw * kx); <----- error, line 1042 Pgh := round(PPgh * ky); Ofx := round(POfx * kx); Ofy := round(POfy * ky); Pw := round(PPw * kx); Ph := round(PPh * ky);

I tried on a raspberry pi, with fpc 3.0.0 and lazarus 1.6rc1. It gives the same error. I investigated further and it's the product that gives the error.

Any idea what's happening ?

Koenraad.

Reply by email

Koenraad Lelong
to Koenraad Lelong

I did some further testing.

I modified the code somewhat :
       tmp1:=PPgw;
       tmp2:=kx;
       tmp1:=tmp1 * tmp2;
       Pgw:=round(tmp1);
//      Pgw := round(PPgw * kx);

tmp1 and tmp2 are Double. Running in gdb and backtracing at the crash gives this :

Program received signal SIGBUS, Bus error.
0x004b45fc in TFRPRINTER__FILLPRNINFO (P=..., this=<error reading variable>) at lr_prntr.pas:1044
1044 tmp1:=PPgw;
(gdb) bt
#0 0x004b45fc in TFRPRINTER__FILLPRNINFO (P=..., this=<error reading variable>) at lr_prntr.pas:1044
#1 0x003bc198 in TFRREPORT__DOPRINTREPORT (PAGENUMBERS=0x744cff8c '1-1', COPIES=1, this=<error reading variable>)
at lr_class.pas:11429
#2 0x003bbe20 in TFRREPORT__PRINTBEFOREMODAL (SENDER=0x75f0a450, this=<error reading variable>) at lr_class.pas:11237 #3 0x004c4548 in TFRPROGRESSFORM__DOBEFOREMODAL (DATA=0, this=<error reading variable>) at lr_progr.pas:88
#4 0x0006b71c in TAPPLICATION__PROCESSASYNCCALLQUEUE (this=<error reading variable>)
at ./include/application.inc:1067
#5 0x000699c0 in TAPPLICATION__IDLE (WAIT=true, this=<error reading variable>) at ./include/application.inc:389
#6 0x00063930 in TCUSTOMFORM__SHOWMODAL (this=<error reading variable>) at ./include/customform.inc:2916
#7 0x004c4484 in TFRPROGRESSFORM__SHOW_MODAL (DOC=0x754ab400, this=<error reading variable>) at lr_progr.pas:70
#8 0x003bbfbc in TFRREPORT__PRINTPREPAREDREPORT (PAGENUMBERS=0x744cff8c '1-1', COPIES=1,
this=<error reading variable>) at lr_class.pas:11265 #9 0x000739d8 in BTNPRINTSETUPCLICK (this=0x756429b0, SENDER=0x75f04870) at modmain.pas:229
#10 0x00224e5c in TCONTROL__CLICK (this=<error reading variable>) at ./include/control.inc:2734
#11 0x00251028 in TBUTTONCONTROL__CLICK (this=<error reading variable>) at ./include/buttoncontrol.inc:54
#12 0x00251928 in TCUSTOMBUTTON__CLICK (this=<error reading variable>) at ./include/buttons.inc:169
#13 0x00250ef4 in TBUTTONCONTROL__WMDEFAULTCLICKED (MESSAGE=..., this=<error reading variable>)
at ./include/buttoncontrol.inc:20
#14 0x00041360 in SYSTEM$_$TOBJECT_$__$$_DISPATCH$formal () #15 0x00223bc8 in TCONTROL__WNDPROC (THEMESSAGE=..., this=<error reading variable>) at ./include/control.inc:2122
#16 0x00215b1c in TWINCONTROL__WNDPROC (MESSAGE=..., this=<error reading variable>) at ./include/wincontrol.inc:5383
#17 0x002f7a14 in DELIVERMESSAGE (TARGET=0x75f04870, AMESSAGE=<error reading variable: Attempt to dereference a generic pointer.>) at lclmessageglue.pas:112
#18 0x00309f78 in GTK2WSBUTTON_CLICKED (AWIDGET=0x985708, AINFO=0x75c5c7e0) at gtk2wsstdctrls.pp:2428
#19 0x76972afc in ?? () from
/usr/lib/arm-linux-gnueabihf/libgobject-2.0.so.0
Backtrace stopped: previous frame identical to this frame (corrupt stack?) (gdb)

Reply by email

Koenraad Lelong
to Koenraad Lelong: I'm trying to print a lazreport on a Raspberry Pi2. It's not working, I get : Bus Error…

Op 29-10-15 om 16:24 schreef Koenraad Lelong:

Show quoted text 16 lines
Hi, I'm trying to print a lazreport on a Raspberry Pi2. It's not working, I get : Bus Error or misaligned data access Press OK to ignore ... Pressing OK does nothing. Any suggestions to solve this ? I also tried the example from http://wiki.lazarus.freepascal.org/Using_the_printer. Koenraad.

Hi,

Hopefully someone with more knowledge than me will look into this : bugtracker issue# 29512

B.T.W. the program from the wiki-page mentioned above does work on the PI.

Koenraad.

Reply by email

ahiggins
to Koenraad Lelong

Not sure if you resolved the missed align data error (im coming to the party late), today i have had the same problem, now below is the crude mod i did to get it working for me, not sure if it will help your problem but worth a try.

LR_Prntr unit. around line 1042

// screen sizes
      Pgw :=
round((PaperSize.PaperRect.PhysicalRect.Right-PaperSize.PaperRect.PhysicalRect.Left)
* kx);
      //Pgw := round(PPgw * kx);
      Pgh :=
round((PaperSize.PaperRect.PhysicalRect.Bottom-PaperSize.PaperRect.PhysicalRect.Top)
* ky);
      //Pgh := round(PPgh * ky);
      Ofx := round(PaperSize.PaperRect.WorkRect.Left * kx);
      //Ofx := round(POfx * kx);
      Ofy := round(PaperSize.PaperRect.WorkRect.Top * ky);
      //Ofy := round(POfy * ky);
      Pw  :=
round((PaperSize.PaperRect.WorkRect.Right-PaperSize.PaperRect.WorkRect.Left)
* kx);
      //Pw  := round(PPw  * kx);
      Ph  :=
round((PaperSize.PaperRect.WorkRect.Bottom-PaperSize.PaperRect.WorkRect.Top)
* ky);
      //Ph  := round(PPh  * ky);

kind regards

Tony

View this message in context: http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-Printing-on-Raspberry-Pi-tp4045084p4048056.html Sent from the Free Pascal - Lazarus mailing list .

Reply by email

Koenraad Lelong
to ahiggins

Op 05-04-16 om 21:00 schreef ahiggins:

Show quoted text 33 lines
Not sure if you resolved the missed align data error (im coming to the party late), today i have had the same problem, now below is the crude mod i did to get it working for me, not sure if it will help your problem but worth a try. LR_Prntr unit. around line 1042 // screen sizes Pgw := round((PaperSize.PaperRect.PhysicalRect.Right-PaperSize.PaperRect.PhysicalRect.Left) * kx); //Pgw := round(PPgw * kx); Pgh := round((PaperSize.PaperRect.PhysicalRect.Bottom-PaperSize.PaperRect.PhysicalRect.Top) * ky); //Pgh := round(PPgh * ky); Ofx := round(PaperSize.PaperRect.WorkRect.Left * kx); //Ofx := round(POfx * kx); Ofy := round(PaperSize.PaperRect.WorkRect.Top * ky); //Ofy := round(POfy * ky); Pw := round((PaperSize.PaperRect.WorkRect.Right-PaperSize.PaperRect.WorkRect.Left) * kx); //Pw := round(PPw * kx); Ph := round((PaperSize.PaperRect.WorkRect.Bottom-PaperSize.PaperRect.WorkRect.Top) * ky); //Ph := round(PPh * ky); kind regards Tony

Hi Tony,

If you had looked at the bug-tracker, you would have found a solution ;-) Maybe I should have posted it here also.
I used an intermediate variable, because a type-cast crashed the application :
// Pgw := round(PPgw * kx); Does not work on Pi

       tmp1:=PPgw;
       Pgw:=round(tmp1 * kx);

etc. where tmp1 is a longint.
I find my solution also a hack, but it works so I'm satisfied.

Koenraad.

Reply by email