From c41e06d64846d54d811f54bcbc429f4e90b536ee Mon Sep 17 00:00:00 2001 From: Wesley Shields Date: Tue, 22 Feb 2011 02:10:51 +0000 Subject: The Arduino Uno (http://arduino.cc/) is an open source hardware micro- controller designed primarily for prototyping and experimentation. Although the devel/arduino port already exists for programming the device, it will not work properly with the newest Arduino hardware. Previous versions of the Arduino used an FTDI USB to Serial interface. The newest Arduino (beginning with the Uno) uses an on-board ATMel 8U2 controller to emulate a USB to Serial interface with its own custom Vendor ID and Hardware ID. As a result, NONE of the existing FreeBSD USB to serial drivers can work with it. This kernel driver supplies the necessary kernel support for the Arduino Uno on FreeBSD. Additionally, some 'ACM' USB Serial devices may work with this driver by manually adding their Vendor ID and Product ID combination to files/ids.txt Official web site WWW: http://www.mrp3.com/uarduno.html PR: ports/153963 Submitted by: Bob Frazier --- comms/uarduno/Makefile | 91 +++++++++++++++++++++++++++++++++++++++++++++ comms/uarduno/distinfo | 2 + comms/uarduno/files/ids.txt | 34 +++++++++++++++++ comms/uarduno/pkg-descr | 16 ++++++++ comms/uarduno/pkg-message | 18 +++++++++ 5 files changed, 161 insertions(+) create mode 100644 comms/uarduno/Makefile create mode 100644 comms/uarduno/distinfo create mode 100644 comms/uarduno/files/ids.txt create mode 100644 comms/uarduno/pkg-descr create mode 100644 comms/uarduno/pkg-message (limited to 'comms/uarduno') diff --git a/comms/uarduno/Makefile b/comms/uarduno/Makefile new file mode 100644 index 000000000000..fe8ddd64334c --- /dev/null +++ b/comms/uarduno/Makefile @@ -0,0 +1,91 @@ +# Ports collection makefile for: uarduno +# Date created: 11-19-2010 +# Whom: 'Big Bad Bob' Frazier +# +# $FreeBSD$ +# + +PORTNAME= uarduno +PORTVERSION= 1.0 +CATEGORIES= comms kld +MASTER_SITES= http://mrp3.com/ + +MAINTAINER= bobf@mrp3.com +COMMENT= FreeBSD Kernel Driver for the Arduino Uno USB interface + +NO_PACKAGE= You must (re)build this port with your kernel source + +# need to enforce installation into kernel module directory +MAKE_ENV+= KMODDIR=${KMODDIR} +LOCALBASE= ${KMODDIR} + +SRCPREFIX?= ${SRC_BASE} + +# some test targets need a predictable source directory +WRKSRC= ${WRKDIR}/uarduno + +PLIST_FILES= uarduno.ko +MAKE_JOBS_SAFE= yes + +# no license required +LICENSE= BSD +NO_LICENSES_INSTALL= yes +NO_LICENSES_DIALOGS= yes + +# +# version 7xxxx and 8xxxx are very different +# so make sure I correctly identify them +# +CFLAGS+= -DKERNELVER=${OSVERSION} + +.include + +.if ${OSVERSION} < 700000 +BROKEN= not tested for earlier than 7.x, probably won't build +.endif + +.if ${OSVERSION} < 800000 +# Simple check for 7.x kernel source (find usb.c) +.if ! exists(${SRCPREFIX}/sys/dev/usb/usb.c) +IGNORE= this port will not build without the latest 7.x kernel source +.endif +.else +# 8.x and later kernels (not tested in 9.x yet, mabye add to kernel?) +# simple check for 8.x and later kernel source (find usb_core.c) +.if ! exists(${SRCPREFIX}/sys/dev/usb/usb_core.c) +IGNORE= this port will not build without the latest kernel source +.endif +.endif + +# post-patch target, copy 'ids.txt' as 'ids.h' (user-modifiable file) +post-patch: + @${CP} ${FILESDIR}/ids.txt ${WRKSRC}/ids.h + +# post-install target, make sure kernel module is unloaded +post-install: + @if kldstat -q -m uhub/uarduno ; then \ + echo "" ; echo " +++ Unloading uarduno.ko (related devices will need to be re-attached)" ; kldunload uarduno ; fi + @${ECHO_MSG} + @${CAT} ${PKGMESSAGE} + @${ECHO_MSG} + +# +# these next 2 targets are for developer use +# +# building a source tarball and related files +uarduno-src-tarball: + ${MAKE} patch + ${MAKE} -C ${WRKSRC} my-clean + tar -c -f ${PORTSDIR}/distfiles/${DISTNAME}${EXTRACT_SUFX} -C ${WRKDIR} uarduno + ${MAKE} makesum + +# partial clean for incremental build and test +uarduno-part-clean: + -${RM} ${WRKDIR}/.patch_done.uarduno._boot_kernel + -${RM} ${WRKDIR}/.configure_done.uarduno._boot_kernel + -${RM} ${WRKDIR}/.build_done.uarduno._boot_kernel + -${RM} ${WRKDIR}/.install_done.uarduno._boot_kernel + ${MAKE} -C ${WRKSRC} my-clean + ${MAKE} patch + +.include diff --git a/comms/uarduno/distinfo b/comms/uarduno/distinfo new file mode 100644 index 000000000000..e75d1301abb3 --- /dev/null +++ b/comms/uarduno/distinfo @@ -0,0 +1,2 @@ +SHA256 (uarduno-1.0.tar.gz) = 0deb0b39b4af3c159ce8f9311fc33fe802c1220d964d26bcbd709786aa687f58 +SIZE (uarduno-1.0.tar.gz) = 62976 diff --git a/comms/uarduno/files/ids.txt b/comms/uarduno/files/ids.txt new file mode 100644 index 000000000000..f05153f0d8ec --- /dev/null +++ b/comms/uarduno/files/ids.txt @@ -0,0 +1,34 @@ +// Arduino UNO USB Serial Port Kernel Driver for FreeBSD +// +// This is a user-modifiable file that can be used to add extra +// USB Vendor ID / Product ID combinations to the list of existing +// combinations that the driver recognizes as an Arduino Uno. +// +// If you modify your Arduino Uno (or obtain a similar unit with a different +// Vendor/Product combination) you can simply modify this file to include +// the new Vendor/Product information. +// +// Place your NEW Vendor ID / Product ID combinations below in the form of +// a C-language structure initializer entry, as follows +// +// { 0xaaaa, 0xbbbb }, +// +// Where '0xaaaa' is the vendor ID, and '0xbbbb' is the product ID that you +// want the driver to recognize as an Arduino UNO. It must end with a ',' +// +// The default value of { 0x2341, 0x0001 } is already included as a reference. +// NOTE: do not remove or modify this entry unless you really really mean it. +// +// If you change this file, you will need to update it each +// time you obtain a fresh copy of the ports tree. +// +// + + { 0x2341, 0x0001 }, // Arduino UNO, vendor 2341H, product 0001H + +// place your entries below this line + + + +// end of file + diff --git a/comms/uarduno/pkg-descr b/comms/uarduno/pkg-descr new file mode 100644 index 000000000000..d6a4bb82d5ca --- /dev/null +++ b/comms/uarduno/pkg-descr @@ -0,0 +1,16 @@ +The Arduino Uno (http://arduino.cc/) is an open source hardware micro- +controller designed primarily for prototyping and experimentation. +Although the devel/arduino port already exists for programming the device, +it will not work properly with the newest Arduino hardware. Previous +versions of the Arduino used an FTDI USB to Serial interface. The newest +Arduino (beginning with the Uno) uses an on-board ATMel 8U2 controller +to emulate a USB to Serial interface with its own custom Vendor ID and +Hardware ID. As a result, NONE of the existing FreeBSD USB to serial +drivers can work with it. This kernel driver supplies the necessary +kernel support for the Arduino Uno on FreeBSD. + +Additionally, some 'ACM' USB Serial devices may work with this driver by +manually adding their Vendor ID and Product ID combination to files/ids.txt + +Official web site +WWW: http://www.mrp3.com/uarduno.html diff --git a/comms/uarduno/pkg-message b/comms/uarduno/pkg-message new file mode 100644 index 000000000000..bbe5f3e5a711 --- /dev/null +++ b/comms/uarduno/pkg-message @@ -0,0 +1,18 @@ +The Arduino Uno uses a specific vendor ID of 0x2341 and product ID of 0x0001 + +If you modify your Arduino Uno to use a DIFFERENT vendor ID or product ID, you +can add your vendor/product combination to the files/ids.txt text file +according to the example shown. Additionally, this driver MAY work with +generic ACM USB Serial Devices. You would need to manually add the +vendor ID and product ID for these devices as well. For ACM devices that +are modems, consider using or modifyig the 'umodem' driver. + +You will need to load the uarduno kernel module before connecting the Arduino UNO +via USB to your computer. The command to manually load the driver is: + + kldload uarduno.ko + +To automatically load the driver on startup, add the following line to +your /boot/loader.conf file: + + uarduno_load="YES" -- cgit v1.2.3