xseignard / cordovarduino

Cordova/Phonegap plugin for USB host serial communication from an Android device.
MIT License
166 stars 112 forks source link

Crashes when open connection with Bixolon USB thermal printer. #68

Open safanmomin opened 8 years ago

safanmomin commented 8 years ago

Hello, I've been using/implementing your plugin for quite a some while now. I've successfully permitted my device using the vendor and product id, But everytime I try to open the connection using the serial.open command the application somehow crashes.

For reference I've been working on Samsung Galaxy Tab A(SM-T355) with android version 6.0.1. The device that I'm using is a Bixolon thermal receipt printer SRP-350II (It's a USB printer). My code looks something like this:

serial.requestPermission({ vid: 5380, pid: 31, driver: 'FtdiSerialDriver' }, function success() { alert('successfully permited') serial.open({ "dtr":false }, function success() { alert('successfully openend'); }, errorCallback); }, errorCallback );

safanmomin commented 8 years ago

@xseignard please acknowledge. :)

xseignard commented 8 years ago

Have you checked the configuration of your printer??

http://www.bixolon.com/upload/download/manual_srp-350ii_user_english_rev_1_05.pdf (page 11, chapter 1.4.1)

safanmomin commented 8 years ago

Thanks for the response. Yes I have checked the configuration and implemented the following properties (baudrate, parity check etc) but somehow my app crashes.

xseignard commented 8 years ago

With what values??

safanmomin commented 8 years ago

These are the values: { baudRate: 9600, dataBits: 1, stopBits: 0, parity: 1, dtr: false };

xseignard commented 8 years ago

So the DIP switch 1 of the serial interface is set as the following?

Switch Value
1.1 ON or OFF
1.2 ON
1.3 OFF
1.4 OFF
1.5 ON or OFF
1.6 OFF
1.7 ON
1.8 OFF

This way your printer should be configured with the following:

So then you would be able to use the following:

{ baudRate: 9600, dataBits: 8, stopBits: 0, parity: 0, dtr: false };

Let me know if it works

xseignard commented 8 years ago

Another question: what kind of usb to serial adapter you use? Are you sure it is compatible with the FtdiSerialDriver ?

xseignard commented 8 years ago

And as stated on image 1.2.1 (page 8) set just connect: Tx (pin 2), Rx (pin 3) and signal gnd (pin 7)

safanmomin commented 8 years ago

Hello! Thanks again for looking into the issue. I tried to work with the properties that you gave but the app crashes.

I'm using a USB type B adapter(IFG-U type USB interface) and an OTG that connects with my android tablet, Sorry but I don't know much about it's compatibility.

The printer is up and running, I've tested it from one of the applications that is provided by bixolon on google playstore.

xseignard commented 7 years ago

Any updates @safanmomin ? I've been afk for a while.

BrianCook commented 4 years ago

Did you ever figure out the problem with this? I have a similar issue with the SRP-350II using a native USB interface. When calling DeviceIoControl with control code IOCTL_USBPRINT_GET_LPT_STATUS (0x220030) it always fails with GetLastError equal to 0x17 ERROR_CRC. This is a simple printer status command that works on all other USB printers including SRP-350III. I suspect there is/was a firmware bug on the SRP-350II.