From owner-freebsd-usb@FreeBSD.ORG Sat Nov 29 20:41:05 2014 Return-Path: Delivered-To: usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 86096802 for ; Sat, 29 Nov 2014 20:41:05 +0000 (UTC) Received: from nm12-vm0.bullet.mail.bf1.yahoo.com (nm12-vm0.bullet.mail.bf1.yahoo.com [98.139.213.140]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3BF56300 for ; Sat, 29 Nov 2014 20:41:04 +0000 (UTC) Received: from [66.196.81.171] by nm12.bullet.mail.bf1.yahoo.com with NNFMP; 29 Nov 2014 20:40:58 -0000 Received: from [98.139.212.234] by tm17.bullet.mail.bf1.yahoo.com with NNFMP; 29 Nov 2014 20:40:58 -0000 Received: from [127.0.0.1] by omp1043.mail.bf1.yahoo.com with NNFMP; 29 Nov 2014 20:40:58 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 279867.32973.bm@omp1043.mail.bf1.yahoo.com Received: (qmail 76147 invoked by uid 60001); 29 Nov 2014 20:40:58 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1417293658; bh=GxJWoFPlMTyb+wglNPR0LxhNpScOhl9StCBvq489CKw=; h=Message-ID:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=2vqPzSvmCgoLTKvw+aKS1kcggKzz6sDlPl8eXsxbNIZKFbzOmWdEoJBjWyeK1l1ksUKWr98eYuLxrA3R5OhSgmm1xfKFt4GH1c0Qx7q2Vn5pqD3akee8YPou/n/qUlCW4wLAPfIlf01zS4DLwC4suZC84Y6Pp57LRuUuY7dGEqw= X-YMail-OSG: 82QVHD0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cGxpc2ggeW91ciB0YXNrIEkgd291bGQgc3VnZ2VzdCBydW4BMAEBAQE- X-Mailer: YahooMailClassic/858 YahooMailWebService/0.8.203.740 Message-ID: <1417293657.7061.YahooMailBasic@web140502.mail.bf1.yahoo.com> Date: Sat, 29 Nov 2014 12:40:57 -0800 From: Jesus Monroy Subject: Re: Question on ue devices autoconfigure versus Linux. To: usb@freebsd.org, Alfred Perlstein In-Reply-To: <54791E62.5000406@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Hans Petter Selasky X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2014 20:41:05 -0000 Alfred, As you may recall, at Anybots USB was the backbone of our bot. And as no one wanted to tackle the USB, besides John and I, it fell to me to read the Spec. John can tell you as much as I can USB is a basket case and a bastard child. To accomplish your task I would suggest running your task in user space (with privileges of course).=20 USB requires timing, negative-timing, fallbacks and timeouts. It is not pretty. Perhaps in 5-10 years we can kill the negative-timing and fallbacks, with some confidence that USB 1.0 are no longer available and cannot be plugged in to new devices. timing, fallbacks and timeouts are straightforward. negative-timing requires that you guess if a 1.0 device might have been attached to bus. Most MFGs ignore this, and either fuck the device or fuck the bus. Recovery requires that your USB bus (or hub) allows you to reset it. Which if you've fucked the bus, means you have to guess when the device was removed and recover in a normal method. Hope this helps. Jesse -------------------------------------------- On Fri, 11/28/14, Alfred Perlstein wrote: Subject: Re: Question on ue devices autoconfigure versus Linux. To: "Jesus Monroy" , usb@freebsd.org Cc: "Hans Petter Selasky" Date: Friday, November 28, 2014, 6:16 PM =20 Well sure, but we have devd in FreeBSD for some time.=A0 It actually does=20 handle the hot plug (sort-of...) I made a custom devd hook for it. =20 The actual problem is that if I boot FreeBSD with the device plugged in=20 then devd never runs my hooks. =20 That and I'm not sure if devd is even the right place... to put my=20 hooks, but it sure seems like it... except for the "doesn't show up at=20 boot". =20 Also really interested in knowing how the heck Linux figures out the IP=20 address? =20 Is there some usb ethernet spec for autoconfiguring??? =20 -Alfred =20 =20 On 11/28/14, 5:05 PM, Jesus Monroy wrote: > Alfred, > I usually don't get the USB mailing list in my inbox. However, > for some reason I fished this out of spam. Indicating to me > I should answer this. > > THE ANSWER: > > Hot swapping has never been a strong point for BSD. > Basically they think, "hot swapping" means, flip a > mechanical switch, remove the device. They DON'T > think like a USB device; which is "plug in and pull" > - at will. > > In the Linux world, there is an army of people that > attack problems like this 'ad hoc'. The BSD > community is far too formal to get it done in > any reasonable time frame. > > In the Linux world, there are a host of "post-boot" > solutions, such as systemd, busd, etc. They all > generally trap an event, be it real (such as an IRQ), > network, program, or user.=A0 This is usually > leverage by /proc, dmesg or similar. > > Hope this helps. > FWIW: I'm living in El Paso Texas for the next 6 months. > > Best of Luck, > Jesse > > > -------------------------------------------- > On Fri, 11/28/14, Alfred Perlstein wrote: > >=A0=A0=A0Subject: Question on ue devices autoconfigure versus Linux. >=A0=A0=A0To: usb@freebsd.org >=A0=A0=A0Cc: "Hans Petter Selasky" >=A0=A0=A0Date: Friday, November 28, 2014, 5:37 PM >=A0=A0=A0 >=A0=A0=A0Hello, >=A0=A0=A0 >=A0=A0=A0We have a widget here, basically a "beagleclone" that runs >=A0=A0=A0Linux. >=A0=A0=A0 >=A0=A0=A0When I plug it into an ubuntu host it shows up as: >=A0=A0=A0 >=A0=A0=A0usb0=A0 =A0 =A0 Link encap:Ethernet=A0 HWaddr >=A0=A0=A08a:18:9f:c4:a9:02 >=A0 =A0 =A0 =A0 =A0 =A0 =A0 inet >=A0=A0=A0addr:169.254.99.129=A0 Bcast:169.254.99.131 >=A0=A0=A0Mask:255.255.255.252 >=A0 =A0 =A0 =A0 =A0 =A0 =A0 inet6 addr: >=A0=A0=A0fe80::8818:9fff:fec4:a902/64 Scope:Link >=A0 =A0 =A0 =A0 =A0 =A0 =A0 UP BROADCAST >=A0=A0=A0RUNNING MULTICAST=A0 MTU:1500=A0 Metric:1 >=A0 =A0 =A0 =A0 =A0 =A0 =A0 RX packets:3 >=A0=A0=A0errors:0 dropped:0 overruns:0 frame:0 >=A0 =A0 =A0 =A0 =A0 =A0 =A0 TX packets:56 >=A0=A0=A0errors:0 dropped:0 overruns:0 carrier:0 >=A0 =A0 =A0 =A0 =A0 =A0 =A0 collisions:0 >=A0=A0=A0txqueuelen:1000 >=A0 =A0 =A0 =A0 =A0 =A0 =A0 RX bytes:626 >=A0=A0=A0(626.0 B)=A0 TX bytes:10727 (10.7 KB) >=A0=A0=A0 >=A0=A0=A0Requires no special setup. >=A0=A0=A0 >=A0=A0=A0However on a FreeBSD machine I need to do this: >=A0=A0=A0 >=A0=A0=A0USBDEV=3D$(shell dmesg | grep '^ugen.*LCD' | sed -E >=A0=A0=A0's/^ugen([0-9]+\.[0-9]+).*/\1/') >=A0=A0=A0# target to make the device show up on freebsd. >=A0=A0=A0config-freebsd: >=A0 =A0 =A0 =A0 =A0 =A0 usbconfig -d >=A0=A0=A0$(USBDEV) set_config 1 >=A0 =A0 =A0 =A0 =A0 =A0 sleep 5 >=A0 =A0 =A0 =A0 =A0 =A0 ifconfig ue0 inet >=A0=A0=A0169.254.99.129/24=A0 up >=A0=A0=A0 >=A0=A0=A0Basically I need to grep dmesg for "ugen" and the string >=A0=A0=A0"LCD", then I >=A0=A0=A0need to run: >=A0 =A0=A0=A0usbconfig -d 3.3 set_config 1=A0 # (3.3 comes from >=A0=A0=A0dmesg) >=A0 =A0=A0=A0then.. >=A0 =A0=A0=A0ifconfig ue0 inet 169.254.99.129/24=A0 up >=A0=A0=A0 >=A0=A0=A0Any idea why Linux can do this all automagically but FreeBSD >=A0=A0=A0needs >=A0=A0=A0manual help? >=A0=A0=A0 >=A0=A0=A0 >=A0=A0=A0I even tried putting some stuff into devd.conf, however devd >=A0=A0=A0doesn't >=A0=A0=A0seem to the right thing if the device is plugged in at boot >=A0=A0=A0time. This >=A0=A0=A0is because devd only seems to know when a device is plugged >=A0=A0=A0in, however >=A0=A0=A0it doesn't trigger events when the device has been present >=A0=A0=A0since boot. >=A0=A0=A0 >=A0=A0=A0Any tips on this?=A0 We can get around this with some >=A0=A0=A0custom rc scripts, >=A0=A0=A0but I was just wondering if FreeBSD could make it more plug >=A0=A0=A0and play. >=A0=A0=A0 >=A0=A0=A0thanks, >=A0=A0=A0-Alfred >=A0=A0=A0_______________________________________________ >=A0=A0=A0freebsd-usb@freebsd.org >=A0=A0=A0mailing list >=A0=A0=A0http://lists.freebsd.org/mailman/listinfo/freebsd-usb >=A0=A0=A0To unsubscribe, send any mail to "freebsd-usb-unsubscribe@freebs= d.org" >=A0=A0=A0 > =20