usbserial

Arduino Android USB connection

╄→尐↘猪︶ㄣ 提交于 2019-12-01 07:31:30
问题 I am using an Arduino Duemilanove and Nexus 7. I have successfully detected the Arduino board and displayed the vendor id and product id. I am trying to transfer data from my tablet to the Arduino board and trying to blink the LED on the board. The code for Android is as follows. Main Activity.java protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); UsbManager manager = (UsbManager) getSystemService(Context.USB

SerialPort.BaseStream.ReadAsync drops or scrambles bytes when reading from a USB Serial Port

假装没事ソ 提交于 2019-11-30 07:38:10
Edit: I've added the sending code and an example of the received output I'm getting. I am reading data from a USB "virtual" serial port connected to an embedded system. I have written two methods for receiving the data, one synchronous and one asynchronous. The synchronous one works, and the asynchronous one loses or scrambles a little bit of the incoming data. I cannot tell why the second one fails. The method that works calls SerialPort.Read with a read timeout set to zero, and it requests everything in the receive buffer. I check the return value to see how many bytes were actually read and

How to identify multiple USB-serial adapters under Ubuntu 10.1

血红的双手。 提交于 2019-11-30 05:30:40
I am reading data from multiple identical USB-serial adapters under Ubuntu 10.1. On occasion, their /dev/tty path changes (eg if other USB devices are connected on startup). I need a way of repeatedly referring to the same adapter through any such changes. The devices all have the same serial numbers, according to udevadm. I think the most likely option is to identify an adapter by which port it is connected to (they don't get moved around). I can find all sorts of interesting /dev paths that might work, but despite all the discussion about udev online, I can't locate a definitive statement

setting parity with controlTransfer method

此生再无相见时 提交于 2019-11-30 05:30:23
Anybody knows how to set the parity with the controlTransfer in Android? I can't find the explanation of this method's parameters anywhere - just some generic info in the ref. One example I found says: conn.controlTransfer(0x40, 0x04, 0x0008, 0, null, 0, 0); //data bit 8, parity none, stop bit 1, tx off But I need to change the parity. Anybody has an idea? Many thanks! yokks You can define the combination of bits to create your own configuration (parity, stop bit & data bit). conn.controlTransfer(0x40, 0x04, 0x0008, 0, null, 0, 0); 1st parameter - 0x40 - request to set or get control data

How to find the path of USB which is mounted to android?

拜拜、爱过 提交于 2019-11-29 15:14:12
I am working on an android application to read data from USB. The usb can be connected to android with serial port and my app can find it. Now, I want to read data files and folder from USB. I have read many articles. I found that they use this code : Environment.getExternalStorageDirectory(); However in my case, I got that the path is /storage/emulated/0. When I try to read all the files which are contained in the path, I got the following statements: /storage/emulated/0/Android /storage/emulated/0/Music /storage/emulated/0/Podcasts /storage/emulated/0/Ringtones and etc. but the path of my

SerialPort.BaseStream.ReadAsync drops or scrambles bytes when reading from a USB Serial Port

女生的网名这么多〃 提交于 2019-11-29 09:36:57
问题 Edit: I've added the sending code and an example of the received output I'm getting. I am reading data from a USB "virtual" serial port connected to an embedded system. I have written two methods for receiving the data, one synchronous and one asynchronous. The synchronous one works, and the asynchronous one loses or scrambles a little bit of the incoming data. I cannot tell why the second one fails. The method that works calls SerialPort.Read with a read timeout set to zero, and it requests

How to identify multiple USB-serial adapters under Ubuntu 10.1

元气小坏坏 提交于 2019-11-29 03:22:10
问题 I am reading data from multiple identical USB-serial adapters under Ubuntu 10.1. On occasion, their /dev/tty path changes (eg if other USB devices are connected on startup). I need a way of repeatedly referring to the same adapter through any such changes. The devices all have the same serial numbers, according to udevadm. I think the most likely option is to identify an adapter by which port it is connected to (they don't get moved around). I can find all sorts of interesting /dev paths that

setting parity with controlTransfer method

谁说胖子不能爱 提交于 2019-11-29 03:07:53
问题 Anybody knows how to set the parity with the controlTransfer in Android? I can't find the explanation of this method's parameters anywhere - just some generic info in the ref. One example I found says: conn.controlTransfer(0x40, 0x04, 0x0008, 0, null, 0, 0); //data bit 8, parity none, stop bit 1, tx off But I need to change the parity. Anybody has an idea? Many thanks! 回答1: You can define the combination of bits to create your own configuration (parity, stop bit & data bit). conn

How to programmatically unplug & replug an arbitrary USB device?

大城市里の小女人 提交于 2019-11-28 03:57:08
I'm trying to fix a non-responsive USB device that's masquerading as a virtual COM port. Manual replugging works, but there may be up to 12 of these units. Is there an API command to do the programmatic equivalent of the unplug/replug cycle? What about using Devcon.exe to "remove" and then "rescan"? DR You can use the C# Hardware Helper Lib and add the ResetDevice function . public bool ResetDevice( IntPtr hDevInfo, IntPtr devInfoData ) // Need to add // public const int DICS_PROPCHANGE = ((0x00000003)); // at the public class Native under //PARMS int szOfPcp; IntPtr ptrToPcp; int

How to programmatically unplug & replug an arbitrary USB device?

梦想与她 提交于 2019-11-27 05:17:15
问题 I'm trying to fix a non-responsive USB device that's masquerading as a virtual COM port. Manual replugging works, but there may be up to 12 of these units. Is there an API command to do the programmatic equivalent of the unplug/replug cycle? 回答1: What about using Devcon.exe to "remove" and then "rescan"? DR 回答2: You can use the C# Hardware Helper Lib and add the ResetDevice function. public bool ResetDevice( IntPtr hDevInfo, IntPtr devInfoData ) // Need to add // public const int DICS