Due to high demand expect some shipping delays at this time, orders may not ship for 1-2 business days.
0

Trellis M4 hid error : Launch Deck Trellis M4
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Trellis M4 hid error : Launch Deck Trellis M4

by davidb21 on Tue May 04, 2021 12:08 pm

Hello,

I am trying to get some hid examples (see below) working but keep hitting library errors.

Can some point me towards a bundle for the Launch Deck Trellis M4 that has hid working.
==
# Launch Deck Trellis M4
# USB HID button box for launching applications, media control, camera switching and more
# Use it with your favorite keyboard controlled launcher, such as Quicksilver and AutoHotkey

import adafruit_trellism4
import time
import random
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode
from adafruit_hid.consumer_control import ConsumerControl
from adafruit_hid.consumer_control_code import ConsumerControlCode

== snip ==



Line 84: kbd = Keyboard()

code.py output:
Traceback (most recent call last):
File "code.py", line 84, in <module>
TypeError: function takes 2 positional arguments but 1 were given

davidb21
 
Posts: 28
Joined: Mon Mar 24, 2014 9:13 am

Re: Trellis M4 hid error : Launch Deck Trellis M4

by kattni on Tue May 04, 2021 2:24 pm

It's not the bundle that is the issue, it is the code. I don't have an exact updated version of the code you're using, but here is a snippet of the setup from a working example.
Code: Select all | TOGGLE FULL SIZE
import usb_hid
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS
from adafruit_hid.keycode import Keycode
 
keyboard = Keyboard(usb_hid.devices)
keyboard_layout = KeyboardLayoutUS(keyboard)

You need to import usb_hid, and provide usb_hid.devices to the Keyboard() object.

kattni
 
Posts: 105
Joined: Fri Aug 18, 2017 6:33 pm

Re: Trellis M4 hid error : Launch Deck Trellis M4

by davidb21 on Tue May 04, 2021 2:47 pm

I found out I was using a old version of the hid library. It now works but now am having with the Mac keyboard mappings.

I have the 0,0 pushbutton working which brings up the Mac screen capture.

I can't get the Mac 'F3' button (code config below) to work which makes all the windows be visible.

Any ideas.

keymap = {
(0,0): (0x001100, KEY, (Keycode.COMMAND, Keycode.SHIFT, Keycode.FIVE)),
#(0,0): (0x001100, MEDIA, ConsumerControlCode.PLAY_PAUSE),

(1,0): (0x110011, KEY, (Keycode.F3)),

davidb21
 
Posts: 28
Joined: Mon Mar 24, 2014 9:13 am

Re: Trellis M4 hid error : Launch Deck Trellis M4

by kattni on Tue May 04, 2021 2:55 pm

I'm not sure. Is it possibly related to Macs often needing the function key to be pressed to access the Fx keys? Or that you're utilising a Mac shortcut that isn't directly assigned to F3, but instead to the alternate keymapping of that key?

Beyond that, I'm uncertain. I would recommend creating a new forum post if you can't sort it out so that your new question doesn't get lost in this topic.

kattni
 
Posts: 105
Joined: Fri Aug 18, 2017 6:33 pm

Re: Trellis M4 hid error : Launch Deck Trellis M4

by davidb21 on Tue May 04, 2021 5:01 pm

I found a work around. I am using (1,0): (0x110011, KEY, (Keycode.CONTROL, Keycode.UP_ARROW)). Thanks!

davidb21
 
Posts: 28
Joined: Mon Mar 24, 2014 9:13 am

Re: Trellis M4 hid error : Launch Deck Trellis M4

by davidb21 on Tue May 11, 2021 7:34 am

I purchased another Trellis M4 kit and downloaded the bundle for the 8 step learn example.

It did not work and there was an error with the neopixle library. I did a md5sum on the neopixle library from the bundle example for the learn application launcher library and saw a different hash.

I placed the neopixle library from the application launch bundle and that fixed the problem.

So it seems like the learn example bundle for the 8 step has an issue.

davidb21
 
Posts: 28
Joined: Mon Mar 24, 2014 9:13 am

Please be positive and constructive with your questions and comments.