Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Nov 2014 12:40:57 -0800
From:      Jesus Monroy <jessemonroy650@yahoo.com>
To:        usb@freebsd.org, Alfred Perlstein <alfred@freebsd.org>
Cc:        Hans Petter Selasky <hselasky@FreeBSD.org>
Subject:   Re: Question on ue devices autoconfigure versus Linux.
Message-ID:  <1417293657.7061.YahooMailBasic@web140502.mail.bf1.yahoo.com>
In-Reply-To: <54791E62.5000406@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <alfred@freebsd.org> wrote:

 Subject: Re: Question on ue devices autoconfigure versus Linux.
 To: "Jesus Monroy" <jessemonroy650@yahoo.com>, usb@freebsd.org
 Cc: "Hans Petter Selasky" <hselasky@FreeBSD.org>
 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 <alfred@freebsd.org>
 wrote:
 >
 >=A0=A0=A0Subject: Question on ue devices
 autoconfigure versus Linux.
 >=A0=A0=A0To: usb@freebsd.org
 >=A0=A0=A0Cc: "Hans Petter Selasky" <hselasky@FreeBSD.org>
 >=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
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1417293657.7061.YahooMailBasic>