Question

J'ai une table de mise à niveau de 23,3 à 4.0.Ça marche bien. Maintenant, j'ai installé une application de test ADB à partir de l'exemple de code. Mais ça ne montre rien.Seul l'écran noir est là lorsque j'attends la souris USB ou le clavier USB.mouse et le clavier fonctionnent bien, mais une application de test ADB ne montre rien.

Comment puis-je tester qui existe-t-il une API accessoire USB est là dans la tablette? Quelqu'un peut-il fournir un exemple de code pour cela?

merci.

Était-ce utile?

La solution

Upgrading the Android device from 2.3.3 to 4.0 may not enough to make sure that it will support accessory mode required by ADK. Check the kernel version of the ROM. If it below 2.6.., then most probably it does not support the accessory mode.

Autres conseils

Try this, taken from http://developer.android.com/guide/topics/usb/accessory.html

UsbAccessory mAccessory;
ParcelFileDescriptor mFileDescriptor;
FileInputStream mInputStream;
FileOutputStream mOutputStream;

...

private void openAccessory() {
    Log.d(TAG, "openAccessory: " + accessory);
    mFileDescriptor = mUsbManager.openAccessory(mAccessory);
    if (mFileDescriptor != null) {
        FileDescriptor fd = mFileDescriptor.getFileDescriptor();
        mInputStream = new FileInputStream(fd);
        mOutputStream = new FileOutputStream(fd);
        Thread thread = new Thread(null, this, "AccessoryThread");
        thread.start();
    }
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top