indigos wrote:Badger wrote:On my linux I wrote a simple udev rule.
Thanks for those, they look handy. I ended up adding my user to the 'dialout' group which allowed me to access ttyACM0.
indigos wrote:Badger wrote:On my linux I wrote a simple udev rule.
Tectu wrote:I've never cared about USB before. Is there now any working example, which demonstrates how to use the USB driver of ChibiOS to do some stuff like USB HID or something else?
for linux-side is better to use lib-usb.Tectu wrote:Maybe someone also got a linux-side example showing how to use the new /dev device?
Code: Select all
void sduDataTransmitted(USBDriver *usbp, usbep_t ep) {
size_t n;
SerialUSBDriver *sdup = usbp->param;
(void)ep;
chSysLockFromIsr();
chnAddFlagsI(sdup, CHN_OUTPUT_EMPTY);
if ((n = chOQGetFullI(&sdup->oqueue)) > 0) {
/* The endpoint cannot be busy, we are in the context of the callback,
so it is safe to transmit without a check.*/
chSysUnlockFromIsr();
usbPrepareQueuedTransmit(sdup->config->usbp,
USB_CDC_DATA_REQUEST_EP,
&sdup->oqueue, n);
chSysLockFromIsr();
usbStartTransmitI(sdup->config->usbp, USB_CDC_DATA_REQUEST_EP);
}
chSysUnlockFromIsr();
}