A Abílio Magalhães Member Licensed User Longtime User May 6, 2014 #1 Hello to all. I'm trying to Print some text to a portable thermal USB printer in my project, but I can't even connect to the Printer. I've made already the connection through NETwork, with the Socket connections and I've made it successfully , but not with USB connection. I've installed the USB Serial library, even ran the example project available there. I've added this Manifest Editor 'permissions' and checked the device_filter.xml file, (readonly). Code: Copy AddActivityText(main, <intent-filter> <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" /> </intent-filter> <meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" android:resource="@xml/device_filter" />) And the project that I've tried was this one in here -> http://www.b4x.com/android/forum/th...-arduinos-and-other-usb-serial-devices.24835/ In the line Code: Copy If usb.Open(9600) Then I get an boolean error saying that cannot parse 0 as boolean, but if I remove the IF statements and left only the code is don't connect. Then I've tried this code Code: Copy If usb.UsbPresent = usb.USB_NONE Then Log("NO CONNECTION") Return End If If (usb.HasPermission) Then Log("Device Information= " & usb.DeviceInfo ) Else Log("FAIL") End If And it connects but when I check the USB permission I got the FAIL Log. Is there anything missing me ? Manifest permissions ? Code implementation?? Regards.
Hello to all. I'm trying to Print some text to a portable thermal USB printer in my project, but I can't even connect to the Printer. I've made already the connection through NETwork, with the Socket connections and I've made it successfully , but not with USB connection. I've installed the USB Serial library, even ran the example project available there. I've added this Manifest Editor 'permissions' and checked the device_filter.xml file, (readonly). Code: Copy AddActivityText(main, <intent-filter> <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" /> </intent-filter> <meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" android:resource="@xml/device_filter" />) And the project that I've tried was this one in here -> http://www.b4x.com/android/forum/th...-arduinos-and-other-usb-serial-devices.24835/ In the line Code: Copy If usb.Open(9600) Then I get an boolean error saying that cannot parse 0 as boolean, but if I remove the IF statements and left only the code is don't connect. Then I've tried this code Code: Copy If usb.UsbPresent = usb.USB_NONE Then Log("NO CONNECTION") Return End If If (usb.HasPermission) Then Log("Device Information= " & usb.DeviceInfo ) Else Log("FAIL") End If And it connects but when I check the USB permission I got the FAIL Log. Is there anything missing me ? Manifest permissions ? Code implementation?? Regards.
Erel B4X founder Staff member Licensed User Longtime User May 7, 2014 #2 The UsbSerial library will only work if the printer acts as a USB to RS232 converter. I don't think that this is the case here. Upvote 0
The UsbSerial library will only work if the printer acts as a USB to RS232 converter. I don't think that this is the case here.