akosije Member Licensed User Longtime User Jan 29, 2015 #1 Error: ** Activity (main) Pause, UserClosed = false ** ** Activity (main) Resume ** Installing file. ** Activity (main) Pause, UserClosed = false ** PackageAdded: package:b4a.example1 ** Activity (main) Create, isFirst = true ** Error opening USB port (Exception) Not initialized ** Activity (main) Resume ** Code: If usb.UsbPresent = usb.open(9600) Then ast.Initialize(Me, "ast", usb.GetInputStream, usb.GetOutputStream) Log(ast) Else Log("Error opening USB port") 'Log(LastException) End If That code works on my attached file but i dont know why this code isnt work on my other project. Attachments test2.zip test2.zip 9.5 KB · Views: 358
Error: ** Activity (main) Pause, UserClosed = false ** ** Activity (main) Resume ** Installing file. ** Activity (main) Pause, UserClosed = false ** PackageAdded: package:b4a.example1 ** Activity (main) Create, isFirst = true ** Error opening USB port (Exception) Not initialized ** Activity (main) Resume ** Code: If usb.UsbPresent = usb.open(9600) Then ast.Initialize(Me, "ast", usb.GetInputStream, usb.GetOutputStream) Log(ast) Else Log("Error opening USB port") 'Log(LastException) End If That code works on my attached file but i dont know why this code isnt work on my other project.
Erel B4X founder Staff member Licensed User Longtime User Jan 29, 2015 #2 Have you added the xml file: https://www.b4x.com/android/forum/threads/usbserial-library-2-0-supports-more-devices.28176/ ? Upvote 0
Have you added the xml file: https://www.b4x.com/android/forum/threads/usbserial-library-2-0-supports-more-devices.28176/ ?
akosije Member Licensed User Longtime User Jan 29, 2015 #3 Hi sir Erel, I already inlucde this on my xml file 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 put the device_filter on res/xml but still same error Upvote 0
Hi sir Erel, I already inlucde this on my xml file 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 put the device_filter on res/xml but still same error
akosije Member Licensed User Longtime User Jan 29, 2015 #4 Its working now!! I just Downloaded the usb serial v2.4 and it works fine!! Upvote 0