I am trying to connect the joystick to USB-A (USB Host) port on the Yun and be able to read the values and pass it to arduino sketch for further action.
Since I am new to Linino, python and arduino Yun, I do not know where to start.
I will be glad to get anything that would help me start with my project.
Here is the specific questions that I have:
How do I make the joystick work with arduino USB host
How do I read values given by the joystick
What is the best way to pass those values to arduino sketch
You can use the modules available for input devices
kmod-input-core
kmod-input-joydev
Then the joystick should appear in /dev/input/ as event or joyXX. You can open it as a file and read its output, then parse it and obtain wanted values.
To pass the data to your sketch you can use the bridge library or directly the serial connection.
As suggested I have installed those two packages, but I can only see event0 under /dev/input which is always there.
Here is the output when I run the command lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 058f:6254 Alcor Micro Corp. USB Hub
Bus 001 Device 003: ID 046d:c215 Logitech, Inc. Extreme 3D Pro
Bus 001 Device 004: ID 058f:6366 Alcor Micro Corp. Multi Flash Reader
I can see that my device is listed under USB 003
If I run lsusb -D /dev/bus/usb/001/003. Here is the output:
Device: ID 046d:c215 Logitech, Inc. Extreme 3D Pro
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x046d Logitech, Inc.
idProduct 0xc215 Extreme 3D Pro
bcdDevice 35.00
iManufacturer 1 Logitech
iProduct 2 Logitech Extreme 3D Pro
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 34
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 30mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0 No Subclass
bInterfaceProtocol 0 None
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.10
bCountryCode 33 US
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 122
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0007 1x 7 bytes
bInterval 10
Device Status: 0x0000
(Bus Powered)
Since I can only see /dev/input/event0 regardless of the joystick status. I wonder if my device is installed or initialized correctly.
When I view the file cat /dev/input/event0 its an empty file
I am new to linux, so any help to install/initialize the device would be appreciated.
@ibnaeem,
what are you trying to do? /dev/input/event0 is directory to connect to your device. It works like a file handle. You can't see anything until the device is doing something. This is not like the /proc directory.