Forum.Deepsoftware.Com

DeepSoftware Products => nrComm Lib VCL (32bit / 64bit) => nrComm Lib => LPT port => Topic started by: chedges on June 30, 2011, 12:50:59 PM

Title: LPT comp no longer works after upgrade to 9.19?
Post by: chedges on June 30, 2011, 12:50:59 PM
Hi,

I'm hoping you can help me with a problem with the 9.19 release (trial) after upgrading from the 8.22 version (Pro).

I'm using the TnrLPT component to send data to a thermal printer and this works perfectly in the 8.22 release.
I have found some issues when running on a x64 windows install so I have installed the 9.19 trial release to see if this
resolves the problem.

I am finding that if I use the 9.19 release on my 32bit Win7 machine, I can no longer print to the printer (no errors and no printed output).
I can switch the components back to the 8.22 release and everything works again.

I need x64 support so I need the 9.19 release but is just doesnt seem to work?

Do you have any suggestions of what to try or what may have changed between 8.22 and 9.19?

Thanks,

Chris Hedges
Tickets.com UK

D2007, NrCommLib 8.22 -> 9.19
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: Roman Novgorodov on July 01, 2011, 09:25:12 AM
Hello

Thank you for your interest in our product.

We need more details about your problem.

Did you try LPTDemo from latest release of nrComm Lib with your device?
Does it work correctly?
Do you see any exceptions?
Do you use administration account for run application?

Possible your system need small cleanup of 8.xx version.
You can try to delete following registry key
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\nrusb
reboot PC and try again.

We tested LPT solution on x64 Win7. All works fine.

Roman Novgorodov
DeepSoftware LLC
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: chedges on July 01, 2011, 10:42:21 AM
Hi Roman,

I've managed to get 9.19 to work in Win 32bit now, so some progress!

Unfortunately when I try the same test on a Win 7 64bit machine I get the following error

"LPT1 Open is Failed - The system cannot find the file specified"

The 64bit machine is using the same printer and the base address of the port is the same as the 32bit machine.
I've checked the 64bit machines registry for the key you mentioned but it doesn't exist.

Running as administrator does not help either

The code I am using is very simple, see below.

      fLPT1.LptPortNo := 1;
      fLPT1.LptIOBase := StrToInt('$' + edtPortBaseAddr.Text);
      fLPT1.Active := True;
      fLPT1.SendString(Ticket);

Any suggestions?

Thanks,

Chris.

Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: Roman Novgorodov on July 01, 2011, 10:58:11 AM
Hello

Possible TnrLpt can not find LPT port on x64 pc.

Please download compiled LPTDemo from our site and run it on your x64 test machine.

Does it show correct list of LPT ports?
Try to click open needed port. Does it show same exception?
Please try to find LOG file after LPTDemo test and upload it here.

Roman Novgorodov
DeepSoftware LLC
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: chedges on July 01, 2011, 11:07:40 AM
Hi Again,

I've tested the LPTDemo on the 64bit machine and it appears to work ok, no errors were displayed and I was able to activate the port.

Does the LPT demo use a different control to the TnrLPT?

[01/07/2011 12:03:08] nrComm Lib v9.17 Pro  (TRIAL! Please register!) Windows 7 [6.1.7601] Service Pack 1
[01/07/2011 12:03:08] TnrLptDriver Open()
[01/07/2011 12:03:08] TnrLptDriver CreateService ...
[01/07/2011 12:03:09] TnrLptDriver WOW64 mode ...
[01/07/2011 12:03:09] TnrLptDriver x64 stub finished. Error Code : 00000000
[01/07/2011 12:03:09] TnrLptDriver StartService ...
[01/07/2011 12:03:09] TnrLPTDirect mode. Base address: 378
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: Roman Novgorodov on July 01, 2011, 11:33:22 AM
Hello

You can take a look at LPTDemo sources in Demos folder of nrComm Lic home directory on your hard drive.
You can modify its sources and add code with string output and test again.

Also you can check that nrLpt1.DirectMode := true;

Roman Novgorodov
DeepSoftware LLC
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: chedges on July 05, 2011, 12:53:40 PM
Hi Roman,

I'm still having issues with printing when using the 9.19 build. I've previously tried your LPT demo on the 64bit machine and that seems to activate the port ok.

I've now tried send some data to the LPT port using my appication rebuilt with 9.19 and it cannot print :( I have ensured the the nrLPT.DirectMode = True
but I cannot get it to work. I do not get any errors raised on my 32bit Win7 machine. If I recompile again with 8.22, it works fine and the printer can print successfully.

As far as I can tell, the LPT port pins are being set differently by the two different versions. I have a small routine to check the LPT pins and to determine if a LPT cable is attached

e.g

function TForm1.LPTDeviceDisconnected : Boolean;
begin
Result := False;

  with fLPT1 do
  begin
    if (not(Pins[pnSelect]) and   //13
        not(Pins[pnNoPaper]) and  //12
            Pins[pnBusy] and      //11
        not(Pins[pnNACK]){ and     //10
            Pins[pnError]} ) then  //15
    begin
    //No Power
      Result := True;
      WriteLog('No Power');
    end
    else
    if (    Pins[pnSelect] and   //13
            Pins[pnNoPaper] and  //12
        not (Pins[pnBusy]) and   //11
            Pins[pnNACK] and     //10
            Pins[pnError]) then  //15
    begin
      //No Cable
      Result := True;
      WriteLog('No Cable');
    end;
  end;

  if Result then
    WriteLog('LPT Printer is disconnected!')
  else
    WriteLog('LPT Printer is connected!');
end;


In 8.22, the above code will correctly indicate that the cable is connected and the printer will print. Switching over to 9.19, the code always reports the cable as disconnected (regardless if the cable is attached or not) and the printer does not print when I send data to it using the LPT.SendString command.

Is there anything I can provide you with that will assist in resolving this issue? I need to get this resolved before I can concentrate on the x64 issues and purchase the 9.19 upgrade.

Many thanks,

Chris.
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: Roman Novgorodov on July 06, 2011, 04:01:49 AM
Hello

Please run LPTDemo, open port and click <Refresh>.
Does demo show correct states of pins?

Roman Novgorodov
DeepSoftware LLC
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: chedges on July 06, 2011, 12:52:30 PM
Hi Roman,

I've performed the test using the pre-compiled version of the LPTDemo I downloaded from your site and a version compiled using 8.22

The image on the left is the 8.22 version. The test was using the same machine and the same printer. you can see the pins are
different between the two versions (Pins 11 and 12 are different)

Any reason why this should be?

(http://i1202.photobucket.com/albums/bb371/Christaan_Hedges/lptdemos.jpg)


Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: Roman Novgorodov on July 08, 2011, 05:45:17 AM
Hello

Thank you for information.

Please try new version of LPTDemo from attachment.

Roman Novgorodov
DeepSoftware LLC
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: chedges on July 08, 2011, 08:44:35 AM
Hi Roman,

It's getting there! I can now print successfully using your new excutable on my 32bit Win7 machine! :)
Unfortunately, it does not work on my 64bit machine :(

Here is a screenshot and the log from the 64bit machine. I get no errors, just nothing happens.



(http://i1202.photobucket.com/albums/bb371/Christaan_Hedges/Win7_64_920.jpg)


[08/07/2011 09:39:11] nrComm Lib v9.20 Pro  (TRIAL! Please register!) Windows 7 [6.1.7601] Service Pack 1
[08/07/2011 09:39:11] TnrLptDriver Open()
[08/07/2011 09:39:11] TnrLptDriver CreateService ...
[08/07/2011 09:39:11] TnrLptDriver WOW64 mode ...
[08/07/2011 09:39:12] TnrLptDriver x64 stub finished. Error Code : 00000000
[08/07/2011 09:39:12] TnrLptDriver StartService ...
[08/07/2011 09:39:12] TnrLPTDirect mode. Base address: 378
[08/07/2011 09:39:22] TnrLPTTry to send string hello<p> ...
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: Roman Novgorodov on July 08, 2011, 11:23:15 AM
Hello

Thank you for quick feedback.

We tested with x64.  Demo changes and gets LPT pins correctly.

Please try new one from attachment. Click new button "Send string2"

Roman Novgorodov
DeepSoftware LLC
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: chedges on July 08, 2011, 12:39:10 PM
Hi Roman,


Good news, the new button seems to work both on 32 and 64bit versions :)

Can you make available a full nrComm trial version available so I can test it within my code?

Thanks so much for your time and assistance!

Chris.
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: Roman Novgorodov on July 11, 2011, 11:51:14 AM
Hello

nrComm Lib v9.20 trial is available in ZIP file on main product page.

Roman Novgorodov
DeepSoftware LLC
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: chedges on July 13, 2011, 11:24:43 AM
Hi Roman,

The version seems to work ok.

I've now purchased the pro version of nrComm but the Share-it! link that got emailed to me only has the 9.19 release.

Can you make the full 9.20 version available?  I can send you any licence information that you may need

Thanks,

Christaan Hedges
Tickets.com Ltd
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: Roman Novgorodov on July 13, 2011, 11:35:13 AM
Hello

Thank you for your information.

Please check your email.

We will upload to ShareIT and Plimus needed files soon.

Roman Novgorodov
DeepSoftware LLC
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: chedges on July 13, 2011, 01:32:57 PM
Hi Roman,

It seems that I still have a problem :(

I seem to be getting a lot of Access Violations when I test the LPT Demo with 9.20 full version.

When I click on the activate checkbox I get an A/V. In the log I find only this

[13/07/2011 14:26:35] nrComm Lib v9.20 Pro Windows 7 [6.1.7601] Service Pack 1
[13/07/2011 14:26:35] TnrLptDriver Open()
[13/07/2011 14:27:36] nrComm Lib v9.20 Pro Windows 7 [6.1.7601] Service Pack 1
[13/07/2011 14:27:36] TnrLptDriver Open()

I still have copies of the 9.19, 8.22 and 9.20a versions of the LPT demo that we have tested and they
seem to work fine when I activate the port :(

I've ensured that there are no old copies of nrComm on the path and I've deleted all old .dcp and bpl files so there is no chance of problems. Re-installing does not help either :(

Any ideas?

Thanks,
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: Roman Novgorodov on July 13, 2011, 05:22:58 PM
Hello

Thank you for your information.
Please remind me your Delphi version.

Roman Novgorodov
DeepSoftware LLC
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: chedges on July 14, 2011, 06:56:34 AM
Hi Roman,

Primarily D2007 but we do use D2009 as well.
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: chedges on July 14, 2011, 02:34:44 PM

Any Progress?
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: Roman Novgorodov on July 15, 2011, 02:09:27 AM
Hello

Did you receive our email with new download link yesterday evening?

Roman Novgorodov
DeepSoftware LLC
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: chedges on July 19, 2011, 07:09:19 AM
Hi Roman,

No, I did not recieve a email :( Could you resend?

Thanks,

Chris.
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: Roman Novgorodov on July 19, 2011, 08:03:27 AM
Hello

Email with link is sent again.

Please check your spam folder or antispam settings.

Roman Novgorodov
DeepSoftware LLC
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: Roman Novgorodov on July 19, 2011, 05:03:24 PM
Hello

Your smtp server blocks our hoster.

Please read following:

Thank you for your information.

It is strange but we can not reproduce exception.

Please send to me full sources of your demo and compiled EXE too.

Good luck!

Roman Novgorodov

DeepSoftware LLC
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: chedges on July 20, 2011, 11:36:07 AM
I've sent you this as an email but just in case you did not get it....

Hi Roman,

I seem to eventually get an error when activating the port and from that point on I always get the error. Rebooting does not help?

I've traced into the code and have located where I think the error is happening.

Putting a breakpoint on the indicated line is never reached. It seems the
IsWow64 method is causing an Access Violation on my machine.

It's a 32bit Win7 machine.

I've attached a small demo app but I guess you will not replicate this.
The older versions of nrComm do not suffer from this problem :(


function TnrDriverBase.CreateService: Boolean; var hSCMan, hService: SC_HANDLE;
    s, sDir:string;
    dwEr:cardinal;
    flWow64:boolean;
begin
  Result := False;
  flWow64 := IsWow64(); <--- seems to be causing the error

//  StopService( );
//  RemoveService();
  Logging(dlDebug, 'CreateService ...'); <--- Breakpoint here never hit
  if not FileExists(fDriverFileName) then begin
    if Length(ResName) = 0 then exit;
    if Length(fDriverFileName) = 0 then begin
      SetLength(sDir, MAX_PATH + 2);
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: Roman Novgorodov on July 21, 2011, 05:26:57 AM
Hello

Thank you for information.

We tested your compiled EXE on following PC's:

XPSP2 32bit, Win 2003 server 32bit, Win7 x64, Win 2008 R2 x64

There is no exceptions after Button1 click.

If you think that exception raises in IsWow64(), please set break point on it and take a look.
Its code is very simple and can not generate AV exceptions ...

When we can not open your project sources because it refers to Unit5 in 'Unit5.pas' {Form5};

We modified DPR and rebuild your demo.

Also please try new EXE from attachment.

Roman Novgorodov
DeepSoftware LLC
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: chedges on July 21, 2011, 08:47:21 AM
Hi Roman,

This seems to have improved things. In a small test app I am able to print.

I'm getting some strange behaviour when I build my real app using the new version. I can open the LPT port but when I check the LPT.Pins property
I get a range check error if I try pins 1 and above, pin zero is ok

e.g 

LPT.Active := True;
Tmp := LPT.Pins[1]; <-- range check error?

This only happens in my main application though?  Any Ideas?
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: chedges on July 25, 2011, 02:26:19 PM
Sorry Roman,

I still have serious problems with 9.21 :(

I'm still trying to get it to work reliably on Win7 32bit so I tried Win7 64bit incase it worked any better. It doesn't :(

I'm getting this error every time when trying a simple application

(http://i1202.photobucket.com/albums/bb371/Christaan_Hedges/LPT_Fail_Win7_64.jpg)

I've attached the very simple application that I used to test this.

I'm also getting reliability problems on Win7 32bit. I've not tracked down the problem yet but I'm getting range check errors when I read values from the .Pins property.

It seems to only happen with my real application. I'm creating the LPT port inside a thread would that be causing the problem?

nrComm 8.22 works perfectly in every way apart from it does not work on 64bit :( what changes were required to make this work on 64bit? can I add them to the 8.22 source?

9.20+ just does not seem to be working reliably for me and this is becoming a critical problem.

is there anything else I can provide as I *have* to get this working very quickly
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: Roman Novgorodov on July 25, 2011, 03:59:58 PM
Hello

Thank you for your information.

Possible your Win32 machine have old version of SYS driver that can be still available after old versions of nrComm.

Please try to find and remove following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\nrio

And try again.

Roman Novgorodov
DeepSoftware LLC
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: chedges on July 26, 2011, 07:14:28 AM
Roman,

The 64bit machine did have that registry key but deleting it did not fix the problem?

Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: Roman Novgorodov on July 26, 2011, 08:07:07 AM
Hello

64bit machine could not have old version of this registry key. Because the old versions nrComm Lib did not support 64bit mode.

Please find and delete this key on x86 (32bit) machine and try run app again.

Roman Novgorodov
DeepSoftware LLC
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: chedges on July 26, 2011, 08:15:14 AM

The 32bit machine does not have that registry key, the 64bit did so I deleted it.
The error screenshot from the previous post is from the 64bit machine.

The 64bit machine still fails in the same way. The 32bit machine works but seems to be unreliable and often reports a "Cannot Create Service" error which requires a reboot before it can work again :(
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: Roman Novgorodov on July 26, 2011, 11:21:30 AM
Hello

We ca not reproduce exception on our side.

If your situation is so critical, possible can you grant to me the RDP access to PC with RAD and exception?
You can use something like http://www.teamviewer.com or ordinary RDP of windows.

Roman Novgorodov
DeepSoftware LLC

Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: chedges on July 26, 2011, 11:55:14 AM
Hi Roman,

My 64bit machine is just a test box with no delphi installed on it.  The 32bit machine has Delphi and Teamviewer installed and is the machine I do all my development on.

if you would like to connect to my 32bit machine that is no problem at all. I can install Delphi on the 64bit machine but that will need a little time to arrange.

Thanks for assistance, is very much appreciated!


Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: Roman Novgorodov on July 26, 2011, 12:17:32 PM
Hello

QuoteThe 32bit machine works but seems to be unreliable and often reports a "Cannot Create Service" error which requires a reboot before it can work again

The reason of this error is that you call open/close port operations too often. Every time when you call Active := True component creates service. Every time when you call Activate := False, component kills service.

Best way if you will open port on start your application and close on exit your program.

We will try to find solution for resolve this restriction.

About 64bit.
We do not see place where can be raised "Range check error". There are no places for arrays or list for indexer.
Please grant TeamViewer ID and pass for access to 64bit machine for tests (email).
Possible I can login to your PC in the next 6 hours or tomorrow morning.

Roman Novgorodov
DeepSoftware LLC
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: chedges on July 27, 2011, 09:36:20 AM
Roman

Thank you for you efforts.

I can now report that the LPT printing is working great on both 32 and 64bit platforms. Awesome!

Will there be a new release of nrComm soon? I'd like to have a new backup install just in case I need to re-install sometime.

Many thanks,

Chris
Title: Re: LPT comp no longer works after upgrade to 9.19?
Post by: Roman Novgorodov on July 27, 2011, 10:05:27 AM
Hello Chris

Thank you for your assist and patience.
We are going to release fixed nrComm Lib in the next 5-7 days.

Roman Novgorodov
DeepSoftware LLC