EzDevInfo.com

usb interview questions

Top usb frequently asked interview questions

Why does adb return offline after the device string?

I use "adb devices" to get following result. Only one device is connected to PC by USB, but we get 8 lines of result.

Could anyone suggest the reason?

WH96TNE00361    offline
WH96TNE00361    offline
WH96TNE00361    offline
WH96TNE00361    offline
WH96TNE00361    offline
WH96TNE00361    offline
WH96TNE00361    offline
WH96TNE00361    offline

Source: (StackOverflow)

Working with USB devices in .NET

Using .Net (C#), how can you work with USB devices?

How can you detect USB events (connections/disconnections) and how do you communicate with devices (read/write).

Is there a native .Net solution to do this?


Source: (StackOverflow)

Advertisements

Linux (Ubuntu): safely remove USB flash disk via command line [closed]

It would just be cool if your shell script helps you to safely remove your flash disk after finishing its job. I did much homework before posting the question asking for a solution which is expected to meet the following needs:

  1. Suppose the flash disk is mounted as /media/A together with many other flash disks and the code can selectively just remove /media/A without interfering other disks. For example I can pass /media/A as an argument.
  2. A light solution. Installing another package of size 100MB to finish the task drives one crazy.
  3. I know some commands like hdparm except their documents are hard to read. If one can offer me a solution I hope he/she can offer also the explanation of the parameters, etc.
  4. Best if the code can handle all kinds of flash disks (e.g. my old one bought in 2003 with 32Mb) (and portable disks optionally).
  5. It should achieve the exact effect as right clicking the disk --> clicking "safely Remove Drive". The safety concern will prevail, otherwise one may just unplug the disk which usually won't hurt.

Source: (StackOverflow)

Android USB host mode "soft-mode" drivers for standard class-compliant USB devices

Now that the Android APIs support working directly with USB devices (since 3.1), I am curious if there has been any work to create "soft-mode" drivers for some of the more popular class-compliant devices (such as audio or HID).

In other words, are there any open source projects that wrap up more useful communication with specific classes of devices into a Java class that can be added to an Android project?

For my purposes, I am specifically interested in USB audio, but it seems that a community-built set of classes derived from Linux kernel module sources could be beneficial to many projects. My hope is that others have thought of the same thing and have already began work. Any pointers in this direction would be most appreciated.


A few more resources that I have stumbled on:


Source: (StackOverflow)

What's the easiest, most practical way to toggle several lightbulbs with a PC? [closed]

This question is mainly electronics related, but it also has a programming aspect.

Some background on the problem

We have a traffic light on a wall in our office. When people come in to the office, they can immediately tell from the traffic light whether last night's automatic build & test runs went smoothly: Green means all tests passed, yellow means some tests failed and red means some builds failed.

Right now, there are three switches on three cables hanging from the traffic light and someone has to manually toggle these every morning. I'm looking for an easy way to automate this process with a PC.

Some background on me

I can write software. I have some soldering experience. I know digital design theory, but I've never built a physical device. I don't have a lot of time on my hands.

The question

How can I control three 110V lightbulbs (or any device) from a PC with the minimum amount of effort (and investment)?

Some lax constraints

  • I don't care about the effort to write the software to control a serial/USB port.
  • Having said that, it would be nice if I don't have to write any software and just use existing tools.
  • I prefer not to do any soldering! I can go with one of those hobby kits where you push components into slots etc. Or perhaps it could be something from Toys "R" Us.
  • I'm willing to purchase an existing device like an Arduino board.
  • It would be nice if I can get this done with just parts that are lying around. For instance, I have an old 2400Bd modem that I can take apart (though, that would probably be followed by some soldering).


Update

Similar projects that are mentioned in the answers:


Source: (StackOverflow)

Eclipse Android SDK cannot see new Samsung Galaxy S4 device via a USB connection

Using Eclipse (Juno SR2) with all the latest updates for Android (ADT plugin v21.1.0) cannot see the new Galaxy S4 as an available device via the USB connection.

Per the Samsung website the correct driver software is "Samsung_USB_Driver_for_Mobile_Phones_v1.5.14.0.ext" (which happens to be the same driver that I have been successfully using with a Samsung Note for the past 18 months).

Even when I go to a command prompt and type "adb.exe devices" to list the connected devices the list is empty.

From within the GS4 I have enabled the allow "unknown sources" for installation of applications, though the "allow debug" checkbox doesn't seem to be included anymore.

Interestingly enough, Windows Explorer does show the handset just fine and I am able to surf the device from Windows.

Any suggestions on how to make Eclipse/Android ADB see the device?


Source: (StackOverflow)

How to sniff a USB port under Windows?

From time to time, I need to dump USB traffic under Windows, mostly to support hardware under Linux, so my primary goal is to produce dump files for protocol analysis.

For USB traffic, it seems that SniffUsb is the clear winner... It works under Windows XP (but not later) and has a much nicer GUI than earlier versions. It produces huge dump files, but everything is there.

However, my device is in fact a USB serial device, so I turned to Portmon which can sniff serial port traffic without the USB overhead.


Source: (StackOverflow)

How to emulate USB devices?

The rest of my team will make for my application a simple non-standard USB microphone, but until they finish it I will have to emulate it, for integration testing purposes.

  1. Is there any risk in a physical loopback? Yes there is
  2. Will a physical loopback work? Only with a USB bridge
  3. There is any way to create a logical loopback? (MSDN has something about this)
  4. There is any general purpose USB emulator software?

In case there is many options available I'd rather work it .NET/Matlab/Python solutions.


Source: (StackOverflow)

How to programmatically unplug & replug an arbitrary USB device?

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?


Source: (StackOverflow)

Android device is not connected to USB for debugging (Android studio)

I am trying to debug my application using a real device instead on the emulator. When I try to connect, it gives me the message:

USB device not found

I tried to unplug and plug it again, but it did not work. And I have also enabled USB debugging and unknown sources options in my device.

Any help is appreciated!

Thanks!


Source: (StackOverflow)

Java USB library

Is there a good Java USB API i can use? I tried JUSB but it doesn't seem to work. It's also very old, no updates since 2001.


Source: (StackOverflow)

Multichannel USB recording with Java Sound API?

I'm trying to record/process some audio from three usb microphones with Java Sound on Snow Leopard (but can switch to Windows if it fixes things). Problem is, when I try to use the mixer that corresponds to the usb mic, Java Sound tells me that the line isn't supported. Specifically, it says this...

Available mixers:

Java Sound Audio Engine

USBMIC Serial# 041270067

Built-in Input Built-in Microphone

Soundflower (2ch)

Soundflower (16ch)

Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Line unsupported: interface TargetDataLine supporting format PCM_SIGNED 96000.0 Hz, 8 bit, stereo, 2 bytes/frame,

...when I ask it to select the USBMIC mixer:

  Mixer mixer = AudioSystem.
          getMixer(mixerInfo[1]);

I have tried matching the audio format to the exact specifications of the microphones (16-bit, 44100Hz, stereo) and it didn't make any difference.

The problem is cropping up here:

 final TargetDataLine line = (TargetDataLine)
        mixer.getLine(info);

It would seem that the mixer and the TargetDataLine don't like each other. Is there some way to get these two to 'match' and get along?

The microphones that I'm using are admittedly a bit strange. They were made to be used in a karaoke video game called SingStar. The mics themselves have standard mono line-in connectors that plug into a little hub (two to a hub) that converts them into a single male usb connector. Strangeness aside, though, they seem to work perfectly fine with Audacity as separate channels, so multichannel recording with them is clearly possible, just maybe not in Java.

I've also considered using a program like Soundflower that shares audio between different programs. However, I'm not sure this will work as I can't see how to make the USB mics inputs to Soundflower and then pipe them into a Java. A quick experiment showed me that I could record audio in Audacity from the mics, pipe it out through Soundflower, and then process in my Java program. Still, what I would like to do is have it all happen in real time in Java.

Anybody familiar with this kind of problem?


Source: (StackOverflow)

What (software) usb sniffers are available for windows? [closed]

Are there any software drivers for windows 7 (64-bit) that can report the data transferred between some application software and a usb device?

I have tried snoopy (http://sourceforge.net/projects/usbsnoop/) but I can't get it working. Possibly I would need to go down the route of installing an earlier version of windows.

Any other suggestions?


Source: (StackOverflow)

Android apps, communicating with a device plugged in the USB port

I'm thinking about an Android app (with possibly an accompanying physical device), and i'm trying to figure out whether this is something that's feasible.

1) Let's say I plug my Android to my PC. Would it be possible for an app installed on the PC to communicate with an app running in the cell phone? I just need a very simplistic data exchange, it can even be one-way (just data pushed from the cell phone to the listening app on the PC, whenever the cell phone wants, I don't need any data sent from PC to phone).

When I plug it in, the phone gives me 4 options (charge, disk drive, HTC sync, tethering), which makes me think this is not doable, but still worth the shot.

2) Would it be possible for an app on the PC to talk to an app on the phone through any other way? (Wi-fi, bluetooth, etc). I'm guessing no on wi-fi since neither party has the other's IP (and I want this to kinda just work, not having to input IPs manually all the time).

3) If I make a device that's plugged to the little USB port at the bottom of the phone (and let's say this is a magical device that can do anything, I don't quite care about those details as long as it's doable). Can I have an Android app talk to that device?

4) Any other ideas to make the phone talk to a "device" that I make, or to an app in the PC are more than welcome. Going "through the web" could be an option (although there'd have to be a central server that I own as a middle man, I believe). But i'd prefer if the communication was direct between the two devices.

Thank you very much for any ideas!
Daniel


Source: (StackOverflow)

Get List of connected USB Devices

How can I get a list of all the connected USB devices on a windows computer?


Source: (StackOverflow)