Re: Add support for Arduino Leonardo to umodem(4)
On Mon, Feb 16, 2015 at 03:31:43PM +0100, Gregor Best wrote: > +/* Arduino SA products */ > +product ARDUINO LEONARDO 0x8036 Arduino Lenoardo Leonardo, not Lenoardo. -- db
Re: Add support for Arduino Leonardo to umodem(4)
On Mon, Feb 16, 2015 at 02:20:06PM +, Stuart Henderson wrote: > [...] > It's Arduino SA isn't it? The rest looks good to me. > [...] The controller reports itself as made by 'Arduino LLC' in the usbdevs output, but according to http://www.linux-usb.org/usb.ids, you're right. I think going with the established name is a better idea. I've attached an amended patch. -- Gregor Best Index: dev/usb/umodem.c === RCS file: /mnt/media/cvs/src/sys/dev/usb/umodem.c,v retrieving revision 1.57 diff -u -p -u -r1.57 umodem.c --- dev/usb/umodem.c12 Jul 2014 20:26:33 - 1.57 +++ dev/usb/umodem.c13 Feb 2015 19:36:39 - @@ -250,6 +250,10 @@ umodem_match(struct device *parent, void id->bInterfaceNumber == 0) ret = UMATCH_VENDOR_PRODUCT; + if (UGETW(dd->idVendor) == USB_VENDOR_ARDUINO && + UGETW(dd->idProduct) == USB_PRODUCT_ARDUINO_LEONARDO) + ret = UMATCH_VENDOR_PRODUCT; + if (ret == UMATCH_NONE && id->bInterfaceClass == UICLASS_CDC && id->bInterfaceSubClass == UISUBCLASS_ABSTRACT_CONTROL_MODEL && Index: dev/usb/usbdevs === RCS file: /mnt/media/cvs/src/sys/dev/usb/usbdevs,v retrieving revision 1.644 diff -u -p -u -r1.644 usbdevs --- dev/usb/usbdevs 9 Jan 2015 20:41:48 - 1.644 +++ dev/usb/usbdevs 13 Feb 2015 19:36:40 - @@ -54,6 +54,7 @@ vendor PLANEX40x0053 Planex Communicat vendor UNKNOWN20x0105 Unknown vendor vendor EGALAX2 0x0123 eGalax vendor UNKNOWN60x01e1 Unknown vendor +vendor ARDUINO 0x2341 Arduino SA vendor HUMAX 0x02ad HUMAX vendor BWCT0x03da Bernd Walter Computer Technology vendor AOX 0x03e8 AOX @@ -977,6 +978,9 @@ product APPLE ISIGHT0x8502 iSight /* Araneus Information Systems products */ product ARANEUS ALEA 0x0001 True Random Number Generator + +/* Arduino SA products */ +product ARDUINO LEONARDO 0x8036 Arduino Lenoardo /* Arkmicro products */ product ARKMICRO ARK3116 0x0232 ARK3116 Serial Index: dev/usb/usbdevs.h === RCS file: /mnt/media/cvs/src/sys/dev/usb/usbdevs.h,v retrieving revision 1.656 diff -u -p -u -r1.656 usbdevs.h --- dev/usb/usbdevs.h 9 Jan 2015 20:42:40 - 1.656 +++ dev/usb/usbdevs.h 13 Feb 2015 19:36:44 - @@ -1,4 +1,4 @@ -/* $OpenBSD: usbdevs.h,v 1.656 2015/01/09 20:42:40 kettenis Exp $ */ +/* $OpenBSD$ */ /* * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. @@ -61,6 +61,7 @@ #defineUSB_VENDOR_UNKNOWN2 0x0105 /* Unknown vendor */ #defineUSB_VENDOR_EGALAX2 0x0123 /* eGalax */ #defineUSB_VENDOR_UNKNOWN6 0x01e1 /* Unknown vendor */ +#defineUSB_VENDOR_ARDUINO 0x2341 /* Arduino SA */ #defineUSB_VENDOR_HUMAX0x02ad /* HUMAX */ #defineUSB_VENDOR_BWCT 0x03da /* Bernd Walter Computer Technology */ #defineUSB_VENDOR_AOX 0x03e8 /* AOX */ @@ -984,6 +985,9 @@ /* Araneus Information Systems products */ #defineUSB_PRODUCT_ARANEUS_ALEA0x0001 /* True Random Number Generator */ + +/* Arduino SA products */ +#defineUSB_PRODUCT_ARDUINO_LEONARDO0x8036 /* Arduino Lenoardo */ /* Arkmicro products */ #defineUSB_PRODUCT_ARKMICRO_ARK31160x0232 /* ARK3116 Serial */ Index: dev/usb/usbdevs_data.h === RCS file: /mnt/media/cvs/src/sys/dev/usb/usbdevs_data.h,v retrieving revision 1.650 diff -u -p -u -r1.650 usbdevs_data.h --- dev/usb/usbdevs_data.h 9 Jan 2015 20:42:40 - 1.650 +++ dev/usb/usbdevs_data.h 13 Feb 2015 19:36:44 - @@ -1,4 +1,4 @@ -/* $OpenBSD: usbdevs_data.h,v 1.650 2015/01/09 20:42:40 kettenis Exp $ */ +/* $OpenBSD$ */ /* * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. @@ -962,6 +962,10 @@ const struct usb_known_product usb_known "True Random Number Generator", }, { + USB_VENDOR_ARDUINO, USB_PRODUCT_ARDUINO_LEONARDO, + "Arduino Lenoardo", + }, + { USB_VENDOR_ARKMICRO, USB_PRODUCT_ARKMICRO_ARK3116, "ARK3116 Serial", }, @@ -11248,6 +11252,10 @@ const struct usb_known_vendor usb_known_ { USB_VENDOR_UNKNOWN6, "Unknown vendor", + }, + { + USB_VENDOR_ARDUINO, + "Arduino SA", }, { USB_VENDOR_HUMAX,
Re: Add support for Arduino Leonardo to umodem(4)
On 2015/02/16 01:08, Gregor Best wrote: > Hi, > > Arduino Leonardos emulate a CDC ACM modem for their serial port. The > following patch adds explicit matching for those in umodem_match, > because apparently the emulation done by the Leonardo is not complete > enough to make umodem attach automatically. > > I've tested a kernel with this patch for a few days now, but only with a > baudrate of 115200, which seems to work fine. > > -- > Gregor Best > > +++ dev/usb/usbdevs 13 Feb 2015 19:36:40 - > @@ -54,6 +54,7 @@ vendor PLANEX4 0x0053 Planex Communicat > vendor UNKNOWN2 0x0105 Unknown vendor > vendor EGALAX2 0x0123 eGalax > vendor UNKNOWN6 0x01e1 Unknown vendor > +vendor ARDUINO 0x2341 Arduino LLC It's Arduino SA isn't it? The rest looks good to me.
Add support for Arduino Leonardo to umodem(4)
Hi, Arduino Leonardos emulate a CDC ACM modem for their serial port. The following patch adds explicit matching for those in umodem_match, because apparently the emulation done by the Leonardo is not complete enough to make umodem attach automatically. I've tested a kernel with this patch for a few days now, but only with a baudrate of 115200, which seems to work fine. -- Gregor Best Index: dev/usb/umodem.c === RCS file: /mnt/media/cvs/src/sys/dev/usb/umodem.c,v retrieving revision 1.57 diff -u -p -u -r1.57 umodem.c --- dev/usb/umodem.c12 Jul 2014 20:26:33 - 1.57 +++ dev/usb/umodem.c13 Feb 2015 19:36:39 - @@ -250,6 +250,10 @@ umodem_match(struct device *parent, void id->bInterfaceNumber == 0) ret = UMATCH_VENDOR_PRODUCT; + if (UGETW(dd->idVendor) == USB_VENDOR_ARDUINO && + UGETW(dd->idProduct) == USB_PRODUCT_ARDUINO_LEONARDO) + ret = UMATCH_VENDOR_PRODUCT; + if (ret == UMATCH_NONE && id->bInterfaceClass == UICLASS_CDC && id->bInterfaceSubClass == UISUBCLASS_ABSTRACT_CONTROL_MODEL && Index: dev/usb/usbdevs === RCS file: /mnt/media/cvs/src/sys/dev/usb/usbdevs,v retrieving revision 1.644 diff -u -p -u -r1.644 usbdevs --- dev/usb/usbdevs 9 Jan 2015 20:41:48 - 1.644 +++ dev/usb/usbdevs 13 Feb 2015 19:36:40 - @@ -54,6 +54,7 @@ vendor PLANEX40x0053 Planex Communicat vendor UNKNOWN20x0105 Unknown vendor vendor EGALAX2 0x0123 eGalax vendor UNKNOWN60x01e1 Unknown vendor +vendor ARDUINO 0x2341 Arduino LLC vendor HUMAX 0x02ad HUMAX vendor BWCT0x03da Bernd Walter Computer Technology vendor AOX 0x03e8 AOX @@ -977,6 +978,9 @@ product APPLE ISIGHT0x8502 iSight /* Araneus Information Systems products */ product ARANEUS ALEA 0x0001 True Random Number Generator + +/* Arduino LLC products */ +product ARDUINO LEONARDO 0x8036 Arduino Lenoardo /* Arkmicro products */ product ARKMICRO ARK3116 0x0232 ARK3116 Serial Index: dev/usb/usbdevs.h === RCS file: /mnt/media/cvs/src/sys/dev/usb/usbdevs.h,v retrieving revision 1.656 diff -u -p -u -r1.656 usbdevs.h --- dev/usb/usbdevs.h 9 Jan 2015 20:42:40 - 1.656 +++ dev/usb/usbdevs.h 13 Feb 2015 19:36:44 - @@ -1,4 +1,4 @@ -/* $OpenBSD: usbdevs.h,v 1.656 2015/01/09 20:42:40 kettenis Exp $ */ +/* $OpenBSD$ */ /* * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. @@ -61,6 +61,7 @@ #defineUSB_VENDOR_UNKNOWN2 0x0105 /* Unknown vendor */ #defineUSB_VENDOR_EGALAX2 0x0123 /* eGalax */ #defineUSB_VENDOR_UNKNOWN6 0x01e1 /* Unknown vendor */ +#defineUSB_VENDOR_ARDUINO 0x2341 /* Arduino LLC */ #defineUSB_VENDOR_HUMAX0x02ad /* HUMAX */ #defineUSB_VENDOR_BWCT 0x03da /* Bernd Walter Computer Technology */ #defineUSB_VENDOR_AOX 0x03e8 /* AOX */ @@ -984,6 +985,9 @@ /* Araneus Information Systems products */ #defineUSB_PRODUCT_ARANEUS_ALEA0x0001 /* True Random Number Generator */ + +/* Arduino LLC products */ +#defineUSB_PRODUCT_ARDUINO_LEONARDO0x8036 /* Arduino Lenoardo */ /* Arkmicro products */ #defineUSB_PRODUCT_ARKMICRO_ARK31160x0232 /* ARK3116 Serial */ Index: dev/usb/usbdevs_data.h === RCS file: /mnt/media/cvs/src/sys/dev/usb/usbdevs_data.h,v retrieving revision 1.650 diff -u -p -u -r1.650 usbdevs_data.h --- dev/usb/usbdevs_data.h 9 Jan 2015 20:42:40 - 1.650 +++ dev/usb/usbdevs_data.h 13 Feb 2015 19:36:44 - @@ -1,4 +1,4 @@ -/* $OpenBSD: usbdevs_data.h,v 1.650 2015/01/09 20:42:40 kettenis Exp $ */ +/* $OpenBSD$ */ /* * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. @@ -962,6 +962,10 @@ const struct usb_known_product usb_known "True Random Number Generator", }, { + USB_VENDOR_ARDUINO, USB_PRODUCT_ARDUINO_LEONARDO, + "Arduino Lenoardo", + }, + { USB_VENDOR_ARKMICRO, USB_PRODUCT_ARKMICRO_ARK3116, "ARK3116 Serial", }, @@ -11248,6 +11252,10 @@ const struct usb_known_vendor usb_known_ { USB_VENDOR_UNKNOWN6, "Unknown vendor", + }, + { + USB_VENDOR_ARDUINO, + "Arduino LLC", }, { USB_VENDOR_HUMAX,