usb

UsbConnection.bulkTransfer returns “-1”. What does it mean?

我与影子孤独终老i 提交于 2019-12-07 10:31:27
问题 According to the doc negative response means failure. How to know what's wrong? is there any full doc about error types? For more curious: I'm trying to upload arduino sketch via USB. First i'm getting bootloader attention by turning DTR/RTS off/on and then sending data using Stk500 protocol. It's working fine if running on mac/arduino via usb (rxtx serial is used) so i think it should work on android AS-IS (just change serial), but it fails to send the data after DTR/RTS toggling. 回答1: From

Using RegisterDeviceNotification in a .NET app

心已入冬 提交于 2019-12-07 10:29:29
问题 I have seen some examples on how to use RegisterDeviceNotification from the Windows API, but I have not seen any .NET examples. I want to write a C# app that is notified when a new drive appears (specifically through USB, firewire, etc). This app needs to be a Windows service, so I can't use WM_DEVICECHANGE messages without some bad-practice hacking. I'd like to avoid that. Can anyone give me a sample of how to use RegisterDeviceNotification in C#, or at least give me a good alternative to it

How to determine USB port version on Windows?

北城以北 提交于 2019-12-07 08:21:50
问题 I'm running Windows 7 and Python 3.5. Once USB stick is connected, my goal is to identify what port version (2.0, 3.0, 3.1) is it connected to and what version of USB is supported by USB stick. Any thoughts are appreciated. 回答1: You should look at USBView by Microsoft. It uses Windows APIs to get information about each USB port and each device and display it. This information includes what speeds the USB port supports and speed the device is using. You can run it as a GUI or you can run it

How to eject a USB HID Device from Mac OSX to use in Ubuntu VM?

耗尽温柔 提交于 2019-12-07 07:54:58
问题 I'm running Ubuntu 14.04LTS, 64bit via VirtualBox on a mac. I want to talk to a USB HID device from my VM via a python app (pyusb) but I can't select the device. From VirtualBox -> Devices -> USB Devices I see my device but it's grayed out. I was hoping to find a command I could run on the mac terminal to 'let go' of it, but it's turning out to be more difficult than I imagined. On an Ubuntu VM via Windows 7, I can take control of the USB HID device via Devices -> USB Devices -> Select my

Android kill process from broadcast receiver

女生的网名这么多〃 提交于 2019-12-07 07:29:23
Hi i'm looking to kill an activity in my application when the usb is disconnected i have a broadcast receiver and all set up and working fine public class USBOff extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Intent intent1 = new Intent(context, SdcardOff.class); startActivity(intent1); finish(); } } This code however tells me that the finish method and startActivity methods need to be created? why is this not working thank you for any help with my problem startActivity is a Context method, not a BroadcastReceiver method. finish is an Activity

How to read/write external USB storage on Android?

别等时光非礼了梦想. 提交于 2019-12-07 07:25:41
问题 I am currently making an app that needs to be able to read from and write to a USB flash drive connected via a USB OTG adapter. Is there an easy way to access this storage via standard Java.io.File APIs? This app is only going to be run on a rooted Motorola Xoom running Android 4.2.2. Any suggestions would be appreciated. 回答1: USB Drives get mounted to your device just like an SDCard does essentially*. The mount path usually resides at: /storage/usb0/ I have not used this on many devices

c# usb detection

我怕爱的太早我们不能终老 提交于 2019-12-07 06:41:47
问题 We have several processes in the current Application. One process handles about detection and removel of USB loader. The code to handle detection and removal as below. protected override void WndProc(ref Message m) { switch (m.Msg) { case Win32.WM_DEVICECHANGE: OnDeviceChange(ref m); break; } base.WndProc(ref m); } private void OnDeviceChange(ref Message msg) { int wParam = (int)msg.WParam; Win32.DEV_BROADCAST_VOLUME dbVol = new Win32.DEV_BROADCAST_VOLUME(); Win32.DEV_BROADCAST_HDR

best way in linux to get usb device added notifications in c

假如想象 提交于 2019-12-07 06:22:42
问题 what Linux library should i use to get asynchronous notifications of added usb devices? I'd like my program to work on any Linux device so I'll need to use a library that isn't specific to one Linux version 回答1: If you are using 'C' then I would suggest using the notification features of libudev. Here is a good link with example 'C' code. libudev Document Hope that helps. --Jim 回答2: You need to include what language you are using before we can talk libraries, but if you want to just hook into

HOW TO: Read out GPS attached via USB (VB.NET) [closed]

隐身守侯 提交于 2019-12-07 05:36:26
Closed . This question needs details or clarity . It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post . Closed 4 years ago . How can i read out GPS-Data from a GPS-USB-Device via VB.NET? it took me a while to gather all information and code-snippets to read latitude/longitude coordinates from a GPS attached via USB. so here is the resulting class clsGpsLocation. it includes a function that checks com ports to determin wether a GPS is connected (FindComPort) and a sub that returns latitude/longitude (GetPos). a public

How to enumerate all HID devices? C#

北慕城南 提交于 2019-12-07 05:28:20
问题 I need to enumerate all HID devices connected to my PC. I tried to use this answer, but it enumerates USBHub devices and I can't find there my HID device. EDIT : I will be glad to know If there any WIN32 API method, to get USB device status (online/offline) using PID and VID? 回答1: I found the answer. This link explains how to do this with ManagementObjectSearcher . Thanks for all who replied! 回答2: Microsoft's WDK has documentation for the HID functions and an overview of how to use them. The