[Serial Port API] - Connection can not be opened - Android Q&A, Help & Troubleshooting

Hello,
I am writing here to see if somebody faced this problem before. I am trying to control a very specific Hardware from an Android device using the android-serialport-api lib: code.google.com/archive/p/android-serialport-api/
My hardware uses a RS232 connector and I connect it to Android with a USB to RS232 adapter, just as it shows on the "solution 2" of this image: code.google.com/archive/p/android-serialport-api/wikis/android_to_rs232_guideline.wiki (Solution 4 seems to be the ideal one, but I do not understand it, I will appreciate any indication here as well)
When I try to open a connection to the port, I always get an error indicating the the connection can not be open. The problem with this approach is, as the wiki mentions, you "may need to root your device in order to change /dev/ttyUSB0 file permission, and to load a kernel module.".
Does anybody had to root their device in order to be able to open tty connections? The tablet I am using is a HANNSpree HSG1351 (which I could not find any rooting guide).
Thanks

I will answer myself here just in case it can be useful for someone else in the future:
I ended up using this serial controller for Android, which makes read / write operations easy: github.com/felHR85/UsbSerial
Before being able to open a serial connection with the device, you should give permissions to the USB as it is explained here: developer.android.com/guide/topics/connectivity/usb/accessory.html#permission-a
Just to clarify, this is generic for any device, doesn't matter if it is rooted or not.

Related

USB 3G/GPRS dongle - Will it work?

Will my huawei e1550 work under android?
I see that some other Adroid devices (china tablet pc like Zenithink and other) have the software, which can config internet connections.
Will Gen8 init this device?
ncuxxx said:
Will my huawei e1550 work under android?
I see that some other Adroid devices (china tablet pc like Zenithink and other) have the software, which can config internet connections.
Will Gen8 init this device?
Click to expand...
Click to collapse
For now, no. Unless Huawei or 3rd party develop driver for it.
My E1550 now also collecting dust coz i'm using 101 most of the time rather than laptop.
If i understand, we need root access to add 3rd party driver? Or there uis no way to compile driver?
This would be quite interesting if it would work.
Would this also enable call/sms functionalities?
I have an AT&T Laptop Connect Dongle which does not work. I have been able to bluetooth tether using PAN. I would rather use adhoc, i haven't found a way yet.
I prefer Archos to improve the stabilities of his 2.2 firmware first before adding more "new" features.
3G dongles
Correct me if I'm wrong, but as far as I was able to digg around, it seems that USB host mode (wich is already in Archos), __usbserial.ko__, and adeqaute parts of devfs rules, are only three really necessary things that are needed on any linux, for USB 3G dongles to get properly recognized (at least Huawei ones).
rest of the things regarding "dial-up" a 3G connection, are done with commands from ppp package (should be in froyo), can be done from shell (busysbox __should__ be sufficient) for a start.
usb_modeswitch package is needed also, but only for the modems that are USB composites with virtual CD-ROM and/or MMC card reader (like mine E1552) in order to switch them to a serial mode (because their are detected as mass-storage initialy). For a start, this can be overcomed by sending adequate AT command's to dongle, that disable dongle's virtual CD-ROM and/or MMC card reader, from some windows machine prior to experimenting with dongle on linux/archos (setting is saved on dongle - you only need to do it once).
Since I still don't have my A101 (should receive it beggining of 2011), can someone tell me from kernel .config file is USB serial support compiled in archos kernel, and if not can we compile it as a additional module (like archos unionfs/ntfs modules is see in other thread) ?

usb serial in diagnostic

Hi I have just noticed in the nokia diagnostic tool in the bottom right the three dots when pressed gives you settings option and within that option it says usb mode Zune or usb serial with an option to choose which one ... What's this serial in this case ?? Will this allow direct access to hdd and find a way to use as mass storage ? or can we use this to access the cpu or other parts of the phone ?? im not sure were the serial point to yet ...
Probably that would be the way to flash rom.
It seems to be used for reparing the device or OS level software debugging - it won't give you USB Mass storage device....Or it maybe if you found the right driver...from Nokia Engineer. On HTC phones, this can be used for tethering with the right driver.
Serial Ports are the port that were used for Modem and Mouse before USB was invented (COM ports) It is the very basic form of communication port that most device implements - which the chipset on Lumia also emulate Serial Port over USB cable. (http://en.wikipedia.org/wiki/Serial_port)
Ahhhh ok thanks very much guys
Didn‘t notice that before, I'll poke at it using a serial debugger once I get home, could be some interesting/fun stuff that can be done
In winxp you can load a driver for a system device. maybe at driver level the connection data can be verified. How:
connect in serial mode. it will at first time detect a nokia rm801 or whatever device and ask for a driver. it finds 4 devices.
for the first, the xp system will itself suggest
1) USB Composite Device
2) will not find anything, and show the dialog to go onto internet, search etc.
Don't search and choose the driver to install yourself, with the downmost radiobutton and click next, in the categories go to System Devices, the driver assist will suggest a Compaq Deskpro Thermal Sensor, install this. Will install without error
3) see 2.
4) see 2.
Because it installs a temperature sensor driver, it must be possible to monitor or probe somehow. help?
My guess that will only gain you access to temprature data from the phone.
Have you tried putty and a baudrate of 9600? this is the most common used baudrate, tho It is quite possible they use 16000 instead if the serial connection is ment to handle data transfer.
I've been looking at the schematics for the phone and I can not seem to find out which chip they have used for GPIO. We would probably need to get hold of service level 3 or 4 manuals for Nokia Care (unless someone wants to dissasemble their phone and have a look at the mainboard)
Edit:
After a bit more digging I think I've traced serial to be managed directly by the CPU.
This suggests that it's a purely SW serial console.
I haven't been able to find any details on WP7/7.1/7.5 SW serial.
Worth looking into but I guess would require disassembly of the software?
what is the protocol for example when doing a software update through Zune? It gets into some kind of bootloader mode then too.
can imagine the serial connection is hosted as sw in the phones sw environment when running the mango os. But is the serial mode still fully sw if you boot it? Don't know if you could find anything in the 15 sec of booting to mango
I think the easiest way of figuring out how this is done is to disassemble the .net library that is used in the WP7 update tool.
I will have access to the required tools when I get home. The tool is this one if you want to get cracking on it:
http://xboxmod.sylvester20007.com/TOOLS/WP7_update_tool.rar

[Q] Perl and access to USB device

Hello, I would like to ask you for your help.
I have a digital multimeter VA18B with USB output. The output is actually optically separated USB to RS232 adapter. Link:
http://www.mastech.com.cn/html/en/products-va18b.htm
Since I have a phone with USB host support (Samsung Galaxy Nexus - latest AOKP), I had an idea that I could use it to record data from the multimeter. But I have no experience with Android software development.
The device itself seems to be supported on Android, because I can connect it and read some rubbish characters in intervals of measurement with this app:
https://play.google.com/store/apps/details?id=slickdevlabs.apps.usbtoserialterm
PC Drivers for this multimeter are very limited - only Windows up to XP. Because I primarily use Windows 7, I already use Linux and this script with my multimeter:
http://multimeter.schewe.com/
Source code is in the zip on that site, and also here: http://pastebin.com/iqKW3iFa
It is written in Perl, works on Linux and Android is "Linux". So my first thought was that it could probably be easy to use the same script on Android. I tried to find how to run Perl scripts on Android and found sl4a:
http://code.google.com/p/android-scripting/
After installing the Perl interpreter it can run my script but it doesn't work. The fact that I don't know Perl doesn't make it easier. The script fails to find the device. I thought it is caused by different naming on Android so I substituted the "/dev/ttyUSB0" thing by "/dev/bus/usb/001/033" which I have found in the already mentioned serial adapter app. But it still doesn't work. In both cases it ends complaining about "Can't open device ...".
Because of my level of knowledge I have no idea what to do next.
1) Can you please help me somehow?
2) Next step after making it work will be saving the data to file. That is another problem I would really appreciate your help with, because I did it just by output redirection in Linux and have no idea how to do it here.
I hope someone took the time to read this and perhaps will try to help me. Thank you very much.
Bump :angel:
Bump :angel:

Access internet

Hello,
I have rooted OnePlus One device (Android 5.1.1 custom ROM Sultanxda) and an old PC which have installed ubuntu 10.04. That PC don't have internet connection so I can't perform sudo apt get comand. Kindly teach me how do I connect to the internet by using my OnePlus One device and above ubuntu version OS.
Thank you.
If you have wireless option on PC its as easy as setting up a mobile hotspot, otherwise you can use a USB cable as well
A quick Google (or xda) search will give lots of guides on this
Thanks for reply. I only have USB cable option. Can you please help me how do I proceed. When I searched on internet all of them saying to have some apt get, but here qestion is when (i don't have internet connection on the PC; my only tool is my device to access the internet) starts to solve the problem, solution starts itself with head of problem. Even if I downloads some file in the device, I am not able to copy them in PC because it is neither mounting the device nor any MTP/ADB functionality available. Is there any way to copy / access the device through twrp?
Bump...
See if you can get MTP to work in Ubuntu with this:
edit -
/lib/udev/rules.d/69-libmtp.rules
Add:
ATTR{idVendor}=="05c6", ATTR{idProduct}=="6764", SYMLINK+="libmtp-%k", MODE="660", GROUP="audio", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1", TAG+="uaccess"
ATTR{idVendor}=="05c6", ATTR{idProduct}=="6765", SYMLINK+="libmtp-%k", MODE="660", GROUP="audio", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1", TAG+="uaccess"
Restart udev:
sudo service udev restart
As far as an internet connection, if your carrier (or rom) supports wifi tethering, then you can get a USB wifi adapter. If you are able to tether, then you can also transfer files wireless by using an app like WiFi File Explorer Pro.
There is no /lib/udev/rules.d/69-libmtp.rules in my PC. Do I have to create one new?
I tried to create one new and paste above two lines and restarted udev, but no luck. When i says lsusb it says :
Bus 001 Device 015: ID 05c6:6775 ualcomm, Inc.
@other:
Kindly don't post your answer(s) for just sake of posting because its frustrating me, why I am fighting with ubuntu, while same is running fine in windows...duh. Before posting your answer please please please check whether its is checked by you or you are just pasting **** answer at all over the internet.
None tested answer yet?

Unknown USB Device (Android Device)

I was wondering if anyone could help me with an issue I am having with Windows 11.
I have an old Samsung Galaxy Tablet (2013), the MicroUSB port had to be replaced as the port had broken. Before the repair, the tablet could connect to my Windows 11 PC with no problem, it showed up in Device Manager and File Explorer fine. After the repair, the Tablet will no longer connect and shows up as an "Unknown USB Device".
All methods I have tried, including installing new Drivers, have failed.
If anyone can help, I will really appreciate it!
Who did the repair? It seems whomever did the repair either didn't use the correct parts or installed them improperly.
A friend of mine did the repair. They are quite good at soldering, I will ask them to have another look at the port.
I know the correct part was used as we got the Port from another tablet of the same model.
Check for hardware issues
There’s a possibility that you’re unable to use your USB device due to a hardware issue, meaning that the problem lies within your computer and not the operating system. Here are two easy ways to test if this is the case, which can easily prove whether you need to look into getting your computer restored or can proceed with the methods below to fix system-originated issues.
Plug out your power supply
For some reason, temporarily unplugging your power supply and then connecting the problematic equipment into your computer may fix the Unknown USB device issue on Windows 10. Simply disconnect all charging cables from your laptop until your computer is only running on its integral battery. Then, plug in the USB device to see if your system recognizes it.
Uninstall the USB Driver in Device Manager
Press the Windows + R keys on your keyboard at the same time to bring up the Run utility.
Type in “devmgmt.msc” without the quotations marks, then hit the OK button. This is going to launch the Device Manager in a separate window.
Expand the Universal Serial Bus controllers section, then select the Unknown USB Device (Device Descriptor Request Failed) from the list.
Right-click on the selected USB device and choose Uninstall from the context menu. Follow any on-screen instructions to remove the device.
When the uninstallation is complete, reboot your system. It’ll automatically reinstall the drive correctly, which may help you get rid of the error you’ve been receiving.
Regards,
J Wick

Categories

Resources