Teensy LC, selecting keyboard only presents a joystick to linux

Status
Not open for further replies.

dabone

New member
I converted a pro micro sketch to the teensy, and I have it working except for one thing.

The teensy also shows up also as /dev/input/js0 as a "Joystick (Teensyduino Keyboard) has 37 axes "

I'm using the arduino ide 1.8.8 with the latest Teensyduino software (Installed on monday).

Source for the project is here.

https://github.com/dabonetn/C64USBKey/blob/master/C64Key3-TeensyLC/C64Key3-TeensyLC.ino

Under tools I'm selecting...

Board: "Teensy LC"
USB Type: "Keyboard"
CPU Speed: "24 Mhz"
Optimize: "Fast"
Keyboard Layout: "US English"


Any reason it's still presenting a joystick? I want keyboard only, no mouse, no joysticks. (It's a Raspberry running retropie, so I've got other joysticks attached and it screws up the order)

Here's what's appearing in syslog.

Code:
Feb 22 17:19:52 retropie kernel: [   33.121595] usb 1-1.2: new full-speed USB device number 4 using dwc_otg
Feb 22 17:19:52 retropie kernel: [   33.254457] usb 1-1.2: New USB device found, idVendor=16c0, idProduct=04d0
Feb 22 17:19:52 retropie kernel: [   33.254476] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Feb 22 17:19:52 retropie kernel: [   33.254481] usb 1-1.2: Product: Keyboard
Feb 22 17:19:52 retropie kernel: [   33.254485] usb 1-1.2: Manufacturer: Teensyduino
Feb 22 17:19:52 retropie kernel: [   33.254489] usb 1-1.2: SerialNumber: 4948230
Feb 22 17:19:52 retropie kernel: [   33.260987] input: Teensyduino Keyboard as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.0/0003:16C0:04D0.0001/input/input0
Feb 22 17:19:52 retropie kernel: [   33.324124] hid-generic 0003:16C0:04D0.0001: input,hidraw0: USB HID v1.11 Keyboard [Teensyduino Keyboard] on usb-3f980000.usb-1.2/input0
Feb 22 17:19:52 retropie kernel: [   33.327642] hid-generic 0003:16C0:04D0.0002: hidraw1: USB HID v1.11 Device [Teensyduino Keyboard] on usb-3f980000.usb-1.2/input1
Feb 22 17:19:52 retropie kernel: [   33.330751] input: Teensyduino Keyboard as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.2/0003:16C0:04D0.0003/input/input1
Feb 22 17:19:53 retropie kernel: [   33.392070] hid-generic 0003:16C0:04D0.0003: input,hidraw2: USB HID v1.11 Device [Teensyduino Keyboard] on usb-3f980000.usb-1.2/input2






Thanks.
Later,
dabone
 
Last edited:
Apparently it's a common bug with linux, detecting multimeda keyboards as joysticks.

Here's a big blacklist of devices that do this.

https://github.com/denilsonsa/udev-joystick-blacklist


I solved it on my setup by editing the usb_desh.h and changing elif defined(USB_KEYBOARDONLY) to read.
This is located in hardware\teensy\avr\cores\teensy3\cores\teensy3 under your arduino directory.

If you do this, you probably lose the multimeda functions, but to me I needed to get rid of the extra fake joystick entry.

When I get some more time, I'll see if I can get it done in the blacklist.

Code:
#elif defined(USB_KEYBOARDONLY)
  #define VENDOR_ID		0x16C0
  #define PRODUCT_ID		0x04D0
  #define MANUFACTURER_NAME	{'T','e','e','n','s','y','d','u','i','n','o'}
  #define MANUFACTURER_NAME_LEN	11
  #define PRODUCT_NAME		{'K','e','y','b','o','a','r','d'}
  #define PRODUCT_NAME_LEN	8
  #define EP0_SIZE		64
  #define NUM_ENDPOINTS         4
  #define NUM_USB_BUFFERS	14
  #define NUM_INTERFACE		3
  #define SEREMU_INTERFACE      1	// Serial emulation
  #define SEREMU_TX_ENDPOINT    1
  #define SEREMU_TX_SIZE        64
  #define SEREMU_TX_INTERVAL    1
  #define SEREMU_RX_ENDPOINT    2
  #define SEREMU_RX_SIZE        32
  #define SEREMU_RX_INTERVAL    2
  #define KEYBOARD_INTERFACE    0	// Keyboard
  #define KEYBOARD_ENDPOINT     3
  #define KEYBOARD_SIZE         8
  #define KEYBOARD_INTERVAL     1
//  #define KEYMEDIA_INTERFACE    2	// Keyboard Media Keys
//  #define KEYMEDIA_ENDPOINT     4
//  #define KEYMEDIA_SIZE         8
//  #define KEYMEDIA_INTERVAL     4
  #define ENDPOINT1_CONFIG	ENDPOINT_TRANSMIT_ONLY
  #define ENDPOINT2_CONFIG	ENDPOINT_RECEIVE_ONLY
  #define ENDPOINT3_CONFIG	ENDPOINT_TRANSMIT_ONLY
  #define ENDPOINT4_CONFIG	ENDPOINT_TRANSMIT_ONLY
  #define ENDPOINT5_CONFIG	ENDPOINT_TRANSMIT_ONLY
  #define ENDPOINT6_CONFIG	ENDPOINT_TRANSMIT_ONLY
 
Status
Not open for further replies.
Back
Top