Your SlideShare is downloading. ×
  • Like
ABC2011 Summer デ部 Joysticks and Gamepads, USB Host
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

ABC2011 Summer デ部 Joysticks and Gamepads, USB Host

  • 6,574 views
Published

 

Published in Technology , News & Politics
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
6,574
On SlideShare
0
From Embeds
0
Number of Embeds
5

Actions

Shares
Downloads
14
Comments
0
Likes
4

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. 3.1 Joysticks and Gamepads (@v vakame) Android appengine2011 7 17
  • 2. HID2011 7 17
  • 3. Joystick Gamepad ...2011 7 17
  • 4. ↑↑2011 7 17
  • 5. • Activity GenericMotionEvent • on dispatch • KeyEvent • GenericMotionEvent • MotionEvent#getHistoricalXXX USB Keyboard Mouse ↑↑2011 7 17
  • 6. public class MainActivity extends Activity { @Override public boolean dispatchGenericMotionEvent(MotionEvent event) { float x = event.getX(); float y = event.getY(); Log.d("Joysticks", "x=" + x + ", y=" + y); return super.dispatchGenericMotionEvent(event); } } ( )2011 7 17
  • 7. 3.1 USB Host @vvakame2011 7 17
  • 8. USB Host • Android Device • • Android Host • • LED … Android2011 7 17
  • 9. API ADK2011 7 17
  • 10. • UsbManager • UsbManager UsbDevice • UsbDevice UsbInterface • UsbInterface UsbEndpoint • UsbEndpoint • UsbDeviceConnection AndroidManifest USB Intent2011 7 17
  • 11. AndroidManifest.xml <manifest ...> <application ...> <activity ...> ... <intent-filter> <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" /> </intent-filter> <meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" android:resource="@xml/device_filter" /> </activity> </application> <uses-sdk android:minSdkVersion="12" /> <uses-feature android:name="android.hardware.usb.host" /> </manifest> /res/xml/device_filter.xml <?xml version="1.0" encoding="utf-8"?> <resources> <usb-device vendor-id="3888" product-id="64" /> </resources>2011 7 17
  • 12. UsbManager usbManager; UsbDevice usbDevice; { // usbManager = (UsbManager) getSystemService(Context.USB_SERVICE); usbDevice = usbManager.getDeviceList().get("/dev/hogehoge"); } { // // getIntent().getAction().equals(UsbManager.ACTION_USB_DEVICE_ATTACHED); usbDevice = (UsbDevice) getIntent().getParcelableExtra(UsbManager.EXTRA_DEVICE); } UsbInterface usbInterface = usbDevice.getInterface(0); UsbEndpoint usbEndpoint = usbInterface.getEndpoint(0); UsbDeviceConnection usbDeviceConnection = usbManager.openDevice(usbDevice); usbDeviceConnection.claimInterface(usbInterface, true); usbDeviceConnection.bulkTransfer(usbEndpoint, ..., 100, 1000); Web2011 7 17
  • 13. http://amzn.to/glitterpanel2011 7 17