🇺🇸Adafruit will not be shipping orders on Independence Day Monday 7/4/2022. Please allow extra time for your order to ship and plan accordingly.🇺🇸
0

Installing circuitpython libraries on Ubuntu 20.04 - usb_hid
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Installing circuitpython libraries on Ubuntu 20.04 - usb_hid

by andrewa on Fri Jan 14, 2022 11:46 pm

I've been able to install circuitpython on an Ubuntu 20.04 machine with
Code: Select all | TOGGLE FULL SIZE
pip3 install adafruit-circuitpython-ble

I can then create a bit of python to talk to an Arduino Nano 33 BLE. Great, works like a charm, and you can communicate between a python program and the Nano over BLE.
I'm interested in having the Ubuntu 20.04 machine communicate via python, but acting a remote keyboard. I would figure installing the hid library would work:
Code: Select all | TOGGLE FULL SIZE
pip3 install adafruit-circuitpython-usb-hid

However when trying to import the usb_hid library for any of the python examples:
Code: Select all | TOGGLE FULL SIZE
import usb_hid

or, when using
Code: Select all | TOGGLE FULL SIZE
from adafruit_hid.consumer_control_code import ConsumerControlCode

I get the 'No module named 'usb_hid' is found'. It appears something else needs to be installed, but from the documentation (https://github.com/adafruit/Adafruit_Ci ... hon_Bundle) it seemed all dependencies should have been installed. What has been missed? In my review of the documentation, one piece said Linux support was limited, but I didn't know if that meant things like this.

andrewa
 
Posts: 143
Joined: Mon Oct 19, 2009 9:53 pm

Re: Installing circuitpython libraries on Ubuntu 20.04 - usb

by danhalbert on Sat Jan 15, 2022 10:16 am

We don't have support for `usb_hid` on host computers via adafruit-blinka. You don't need `usb_hid` to do BLE keyboards, but, the underlying library we use for BLE does not support the host computer acting as a BLE peripheral (which is what you need for BLE HID), so you can't have Ubuntu act as a BLE keyboard with CircuitPython.

You can do this the other way round, with a microcontroller board acting as a peripheral.

danhalbert
 
Posts: 3257
Joined: Tue Aug 08, 2017 12:37 pm

Please be positive and constructive with your questions and comments.