I am working on USB communication between an Android Galaxy S III smartphone and a device which does not conform to Android Open Accessory device definition. I want to transfer asynchronously bulk data from the device to the host. The connection between the host and device works correctly, what has been verified by sending control commands to the device.
1. Can this transfer be done with an endpoint of the bulk type (USB_ENDPOINT_XFER_BULK) or it has to be the interrupt type (USB_ENDPOINT_XFER_INT) as it is specified in the MissileLauncher app sample?
2. Assuming that control commands send to the device work correctly, can asynchronous bulk transfer be accomplished with just these two following methods or some other methods need to be used?
a) queue of the UsbRequest class;
b) requestWait of UsbDeviceConnection class?
3. Does the request.queue call fill the data buffer after the connection.requestWait returns or some other conditions need to be checked?
Related
I have manipulated the Serial port. I can send and receive data. I can toggle the RTS line. However I have not been able to read the Status of the CTS line. Well it is always LOW, even when I pull it to 5V.
Has any body used this line. Does it work?
By the way I have used eVB to write the code.
What I need is to monitor the status of a line which may be set to HIGH or LOW. Can I use any other pins to monitor an external device?
By the way at the same time the serial port is also used to receive and transmit data. So I can not use the serial port.
SOLVED - But I'm not sure how, I was redesgning the app so that I could put it up here for other leo owners to test and gave it one last go to take a screenshot of the error to show people what I was looking for and viola it starts working (I never changed the TCP code) sorry anyone who finds this who has the same issue but it just randomly started working!!
Hi fellow devs,
After a massive googling session I have not been able to find an answer to the following issue:
I am writing a TCP client/server app with my PC as the server and the client being my HD2.
I am writing the app in VB.net using the .net compact framework 3.5 and the windows mobile 6 sdk.
I just cannot get the following code on the client side to work over wifi:
Code:
Dim ParsedIPAddress As IPAddress = IPAddress.Parse("192.168.1.10")
Dim client As New TcpClient()
client.Connect(ParsedIPAddress, 7209)
I get the following exception:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
Click to expand...
Click to collapse
If I connect the phone via active sync it will work and I can send and recieve data ok so it appears there is no issue with the code itself.
While connected via active sync - if I turn off the server side app I get the following exception:
No connection could be made because the target machine actively refused it
Click to expand...
Click to collapse
However the exception message remains as the original if I do the above but using wifi so it just is not able to establish a link at all (or not even trying) using wifi??
-----------------
I have tried:
1. Ensuring that windows firewall on the server is off and not getting in the way of anything
2. Ensured that my mobile has got an active wifi connection and can see the machine (wifi remote control apps such as GRemotePro work ok)
3. Turned off all other types of data connection (GPRS,3G) to make sure my mobile has only one route out
------------------
Is there anyone out there who has successfully got TCP to work with the .net compact framework and if so how???
Should I be using another class rather than TCPClient maybe the underlying Sockets class?
Any help would be greatly appreciated.
Cheers,
Prime.
P.S. I don't mind if people only have a solution in C# I'm happy to do any translation etc...
Socket class also fails
Ok so I've tried the socket class now as well and that fails in exactly the same way over wifi, ensured that I can ping my device and ping my pc from the device so clearly the underlying hardware is working just not for the TCPClient or Socket... Any ideas anyone?
Have you enabled port forwarding for the relevant port and IP address in your wireless router?
That's the only thing that springs to mind for me.
Thanks for the reply but...
Hey John,
Thanks for trying to help although unfortunately this does not bear any consquence in this particular situation, you only need to do port forwarding if Network Address Translation is going on between you and the end point. In this case the endpoint (IP + Port) is on the internal LAN with no address translation in between. It appears the the internal WIFI adapter is not being accessed correctly from the application i.e. this is an internal issue on the phone not an issue with the network in general as I can run the same code via active sync and it works also I can convert the project to a standard windows pc app and run the same code from a pc and it works. Oh and of course every other damn (this is really wierd) wifi app I've got works so something with the .net cf and wifi maybe??
Cheers,
Tony.
A development...
Ok so I have dug out my old Orbit II just to see if this was device related and low and behold it is ARGGGHHH!!! The app works just fine on the Orbit II over wifi.
Does anyone know of any policies, security or otherwise, that would stop the HD2 (leo) from being able to use wifi from the .net cf?
<<--delete-->>
Generic reasons for communication failures
Hi
This is a pretty generic problem, I'm afraid you can't give an exact idea of where is the problem so I can't give also an exact solution.
Usually a communication problem is due to one of this three
1) The server does not listen or does not receive
2) There is a problem with the network
3) The client does not make the call
Type 1 should be checked trying to connect to the server with a PC or a laptop. You should be able to make the client run in a PC.
Usually when a (web) server has a (web) tcp service stopped, when you try to connect to it it rejects the connection (this is what that of "the target machine refused it" sounds to me). Start then the (web) service on the server. Change (web) for your application.
My advice is that you should have something in the server side where you could run a wireshark sniffer. Then you would see all the traffic coming from the PDA and see if your client is sending packets.
Type 2 are the ones that can be checked with a ping. Maybe there is a firewall somewhere dropping the packets.
Type 3 may be due to several things
a wrong code (I don't know, there is a lot of time since I made programs)
you're trying to connect to a dns name that can't be resolved. Try with IP address.
You have a wrong network configuration. The server should be in the same network but client is not able to get the server's (or the router's) MAC with the ARP protocol. So it doesn't make the call.
I hope it helps.
Regards
OK this might be in the wrong place if so sorry, however might be of use and maybe can be used to dev some work arounds when tethering...
Intro seemingly ATT US have started to spot people who are tethering BUT not on a data plan that "alows" tehtering (we can argue the rights and wrongs of that but this isnt about that issue)
People where asking about how they could tell, I found the following on The Register
QQQ
For all you wondering how they can tell:
All IP packets have something called a TTL associated with them. It stands for Time To Live. Every "hop" along the network from one router to the next reduces the TTL by one. When it reaches 0, the packet is dropped. This was introduced to keep routing problems from overloading the network. If for example, by some error a packet was going around in a circular path, the TTL would eventually reach 0 and prevent a packet storm.
The thing is, ALL routing devices do this. OSes use standard TTLs. For example, let's say both your iPhone and laptop use 127 for the TTL. AT&T will receive packets from your iPhone with a TTL of 127, but since the packets from your laptop pass through your iPhone first, they arrive at AT&T with a TTL of 126. They can detect a tethered device this way.
Apple uses a TTL of 64 for the iPhone, by the way. So change the TTL on your computer to "65" and there should be no problem. Here's how to do it:
1. Click Start - Search and type “regedit”. This launches the WIndows Registry.
2. In the registry, navigate to the following registry key [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters] HKEY_LOCAL_MACHINE
\SYSTEM
\CurrentControlSet
\Services
\Tcpip
\Parameters
3. In the right pane, right-click and select New – DWORD (32-bit value) and set its name as “DefaultTTL” and set its value anything between “0? and “255?. The value sets the number of Hops or links the packet traverses before being discarded.
Kudos to Ryan Laster1. I don't have an iPhone to test this.
UQUQUQ
Ok for most that is straight forward and simple little process, however we would need to know what the TTL for the Hero (or all HTC's) is and then either alter it when using tehtering (alter the tethering APK) or write a script that when tathering alters the computers TLL too Hero+1
Ok so hope th above makes somesense and it can be used by some one
If not... carry on the good work
Note that there are more ways to detect stuff like hidden network segments, not just TTL - although TTL spoofing certainly doesn't hurt.
Although it's safer when done directly on the device *behind* the tethered phone, not on the phone itself.
Just a question about this way to hide tethering. I have a captivate that at&t does not know is a smartphone. If I tether will at&t know I have a smartphone. As there are many older phones that would tether (so to speak). As at&t does not have a non smartphone tethering plan. Can I just say I am tethering with a non smartphone?
So I need to find a way to send terminal commands to an Android device wirelessly (NOT ON THE SAME NETWORK).
I say not on the same network because I CAN NOT use adb wirelessly.
Please note: this is not for hacking purpose. I will do this with user's permission and the password they set.
Couple years ago, there was an application that did something similar.
http://forum.xda-developers.com/showthread.php?t=2354884
It is very outdated and didn't work on 3 phones that I tried.
Also, the remote device will always have data connection and an ip.
Is there anything similar out there?
If not, I am open to creating my own with some guidelines/help from amazing xda-memebers!!
Thank you.
Hi,
I've been trying for some time to share an internet connection between an android phone (tried with several phones) and an android Tablet (Samsung Active Tab 2).
Rooted the tablet (after some very long research) and tried the following methods:
1. Connect two devices with OTG connector, turned on RNDIS and configured both rndis0 interfaces to be on the same network (different IP addresses ofc) - no ping, nor udp messages (using a UDP Sender\Receiver app) go through.
2. Tried creating a VPN server on the host device (the one providing internet) which creates a tun0 interface that listens to the rndis0 interface - Could not connect to server.
3. Used "Easy Tether Lite" on both devices and managed to share internet, but limited to the Lite version which allowed the use of HTTP only - This shows that it can actually be done using only a USB cable and OTG adapter.
Would appreciate some help with this matter.
Thank you all,
EDIT: Was thinking this may be done using a different Ethernet interface instead of RNDIS. Any ideas?
Shedaim said:
Hi,
I've been trying for some time to share an internet connection between an android phone (tried with several phones) and an android Tablet (Samsung Active Tab 2).
Rooted the tablet (after some very long research) and tried the following methods:
1. Connect two devices with OTG connector, turned on RNDIS and configured both rndis0 interfaces to be on the same network (different IP addresses ofc) - no ping, nor udp messages (using a UDP Sender\Receiver app) go through.
2. Tried creating a VPN server on the host device (the one providing internet) which creates a tun0 interface that listens to the rndis0 interface - Could not connect to server.
3. Used "Easy Tether Lite" on both devices and managed to share internet, but limited to the Lite version which allowed the use of HTTP only - This shows that it can actually be done using only a USB cable and OTG adapter.
Would appreciate some help with this matter.
Thank you all,
EDIT: Was thinking this may be done using a different Ethernet interface instead of RNDIS. Any ideas?
Click to expand...
Click to collapse
hello,
I'm facing the same situation. I had the idea that option 1 should be easy but not.
The phone detect the tablet device and let me to activate the function "USB tethering" but nothing change on the tablet, impossible to navigate or ping.