Hello,
I use the following code to print receipt with an old STMicro thermal printer.
Now I try to use a new POSBANK printer, using the same android hardware.
First I print an info page using the manufacturer sdk toool.
and then I try to use my B4A app changing the following pice of code:
The device info returns all correct info but I allways get usb1.USB_NONE when opening the usb port.
Any idea ?
May be handshake important?
Thank you.
Fabrizio
Italy
I use the following code to print receipt with an old STMicro thermal printer.
B4X:
If usb1.UsbPresent(portausb) = usb1.USB_NONE Then ' Ver_2.4
Log("Msgbox - no device")
Msgbox("No USB device or accessory detected!", "Error")
Log("Msgbox - returned")
End If
If (usb1.HasPermission(portausb)) Then ' Ver_2.4
Log(usb1.DeviceInfo(portausb))
usb1.SetCustomDevice(usb1.DRIVER_SILABS, 0xdd4, 0x198)
dev = usb1.Open(19200, portausb) 'STMicroeletronics
If dev <> usb1.USB_NONE Then
Log("Connected successfully! 1")
astreams1.Initialize(usb1.GetInputStream, usb1.GetOutputStream, "astreams1")
'THIS IS VERY IMPORTANT- PARAMETER
usb1.SetParameters(19200, usb1.DATABITS_8,usb1.STOPBITS_1, usb1.PARITY_NONE)
'START PRINT
astreams1.Write(PrintBuffer.GetBytes("UTF8"))
Sleep(1000)
astreams1.SendAllAndClose
Else
Log("Error opening USB port "&portausb)
End If
Else
usb1.RequestPermission(portausb) ' Ver_2.4
End If
Now I try to use a new POSBANK printer, using the same android hardware.
First I print an info page using the manufacturer sdk toool.
and then I try to use my B4A app changing the following pice of code:
B4X:
Log(usb1.DeviceInfo(portausb))
'usb1.SetCustomDevice(usb1.DRIVER_SILABS, 0x1504, 0x03ee)
usb1.SetCustomDevice(usb1.DRIVER_SILABS, 5380, 1011)
dev = usb1.Open(9600, portausb)
If dev <> usb1.USB_NONE Then
.....
....
The device info returns all correct info but I allways get usb1.USB_NONE when opening the usb port.
Any idea ?
May be handshake important?
Thank you.
Fabrizio
Italy