Re: Question on ue devices autoconfigure versus Linux.

2014-11-29 Thread Jesus Monroy via freebsd-usb
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). 

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 alf...@freebsd.org wrote:

 Subject: Re: Question on ue devices autoconfigure versus Linux.
 To: Jesus Monroy jessemonroy...@yahoo.com, u...@freebsd.org
 Cc: Hans Petter Selasky hsela...@freebsd.org
 Date: Friday, November 28, 2014, 6:16 PM
 
 Well sure, but we have devd in
 FreeBSD for some time.  It actually does 
 handle the hot plug (sort-of...) I made a custom devd hook
 for it.
 
 The actual problem is that if I boot FreeBSD with the device
 plugged in 
 then devd never runs my hooks.
 
 That and I'm not sure if devd is even the right place... to
 put my 
 hooks, but it sure seems like it... except for the doesn't
 show up at 
 boot.
 
 Also really interested in knowing how the heck Linux figures
 out the IP 
 address?
 
 Is there some usb ethernet spec for autoconfiguring???
 
 -Alfred
 
 
 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.  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 alf...@freebsd.org
 wrote:
 
    Subject: Question on ue devices
 autoconfigure versus Linux.
    To: u...@freebsd.org
    Cc: Hans Petter Selasky hsela...@freebsd.org
    Date: Friday, November 28, 2014, 5:37
 PM
    
    Hello,
    
    We have a widget here, basically a
 beagleclone that runs
    Linux.
    
    When I plug it into an ubuntu host it
 shows up as:
    
    usb0      Link
 encap:Ethernet  HWaddr
    8a:18:9f:c4:a9:02
               inet
    addr:169.254.99.129 
 Bcast:169.254.99.131
    Mask:255.255.255.252
               inet6
 addr:
    fe80::8818:9fff:fec4:a902/64
 Scope:Link
               UP
 BROADCAST
    RUNNING MULTICAST  MTU:1500 
 Metric:1
               RX
 packets:3
    errors:0 dropped:0 overruns:0 frame:0
               TX
 packets:56
    errors:0 dropped:0 overruns:0
 carrier:0
              
 collisions:0
    txqueuelen:1000
               RX
 bytes:626
    (626.0 B)  TX bytes:10727 (10.7
 KB)
    
    Requires no special setup.
    
    However on a FreeBSD machine I need to
 do this:
    
    USBDEV=$(shell dmesg | grep
 '^ugen.*LCD' | sed -E
    's/^ugen([0-9]+\.[0-9]+).*/\1/')
    # target to make the device show up on
 freebsd.
    config-freebsd:
             usbconfig -d
    $(USBDEV) set_config 1
             sleep 5
             ifconfig ue0
 inet
    169.254.99.129/24  up
    
    Basically I need to grep dmesg for
 ugen and the string
    LCD, then I
    need to run:
      usbconfig -d 3.3 set_config
 1  # (3.3 comes from
    dmesg)
      then..
      ifconfig ue0 inet
 169.254.99.129/24  up
    
    Any idea why Linux can do this all
 automagically but FreeBSD
    needs
    manual help?
    
    
    I even tried putting some stuff into
 devd.conf, however devd
    doesn't
    seem to the right thing if the device
 is plugged in at boot
    time. This
    is because devd only seems to know
 when a device is plugged
    in, however
    it doesn't trigger events when the
 device has been present
    since boot.
    
    Any tips on this?  We can get

Re: Question on ue devices autoconfigure versus Linux.

2014-11-28 Thread Alfred Perlstein
Well sure, but we have devd in FreeBSD for some time.  It actually does 
handle the hot plug (sort-of...) I made a custom devd hook for it.


The actual problem is that if I boot FreeBSD with the device plugged in 
then devd never runs my hooks.


That and I'm not sure if devd is even the right place... to put my 
hooks, but it sure seems like it... except for the doesn't show up at 
boot.


Also really interested in knowing how the heck Linux figures out the IP 
address?


Is there some usb ethernet spec for autoconfiguring???

-Alfred


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.  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 alf...@freebsd.org wrote:

  Subject: Question on ue devices autoconfigure versus Linux.
  To: u...@freebsd.org
  Cc: Hans Petter Selasky hsela...@freebsd.org
  Date: Friday, November 28, 2014, 5:37 PM
  
  Hello,
  
  We have a widget here, basically a beagleclone that runs

  Linux.
  
  When I plug it into an ubuntu host it shows up as:
  
  usb0  Link encap:Ethernet  HWaddr

  8a:18:9f:c4:a9:02
 inet
  addr:169.254.99.129  Bcast:169.254.99.131
  Mask:255.255.255.252
 inet6 addr:
  fe80::8818:9fff:fec4:a902/64 Scope:Link
 UP BROADCAST
  RUNNING MULTICAST  MTU:1500  Metric:1
 RX packets:3
  errors:0 dropped:0 overruns:0 frame:0
 TX packets:56
  errors:0 dropped:0 overruns:0 carrier:0
 collisions:0
  txqueuelen:1000
 RX bytes:626
  (626.0 B)  TX bytes:10727 (10.7 KB)
  
  Requires no special setup.
  
  However on a FreeBSD machine I need to do this:
  
  USBDEV=$(shell dmesg | grep '^ugen.*LCD' | sed -E

  's/^ugen([0-9]+\.[0-9]+).*/\1/')
  # target to make the device show up on freebsd.
  config-freebsd:
   usbconfig -d
  $(USBDEV) set_config 1
   sleep 5
   ifconfig ue0 inet
  169.254.99.129/24  up
  
  Basically I need to grep dmesg for ugen and the string

  LCD, then I
  need to run:
usbconfig -d 3.3 set_config 1  # (3.3 comes from
  dmesg)
then..
ifconfig ue0 inet 169.254.99.129/24  up
  
  Any idea why Linux can do this all automagically but FreeBSD

  needs
  manual help?
  
  
  I even tried putting some stuff into devd.conf, however devd

  doesn't
  seem to the right thing if the device is plugged in at boot
  time. This
  is because devd only seems to know when a device is plugged
  in, however
  it doesn't trigger events when the device has been present
  since boot.
  
  Any tips on this?  We can get around this with some

  custom rc scripts,
  but I was just wondering if FreeBSD could make it more plug
  and play.
  
  thanks,

  -Alfred
  ___
  freebsd-usb@freebsd.org
  mailing list
  http://lists.freebsd.org/mailman/listinfo/freebsd-usb
  To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org
  



___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org


Re: Question on ue devices autoconfigure versus Linux.

2014-11-28 Thread Ed Maste
On 28 November 2014 at 20:16, Alfred Perlstein alf...@freebsd.org wrote:

 Also really interested in knowing how the heck Linux figures out the IP
 address?

The 169.254.x.x is a link-local IPv4 address - see RFC 3927.

I haven't used it, but the avahi-autoipd pkg might take care of it for you.
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org


Re: Question on ue devices autoconfigure versus Linux.

2014-11-28 Thread Alfred Perlstein


On 11/28/14, 5:36 PM, Ed Maste wrote:

On 28 November 2014 at 20:16, Alfred Perlstein alf...@freebsd.org wrote:

Also really interested in knowing how the heck Linux figures out the IP
address?

The 169.254.x.x is a link-local IPv4 address - see RFC 3927.

I haven't used it, but the avahi-autoipd pkg might take care of it for you.

Well remote side (the beagleclone running linux) is hardwired to 
169.254.99.130 and somehow the Ubuntu box I plug it into sorts that out.


On MAC same thing happens:
en5: flags=8863UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST mtu 1500
ether 5e:7e:b7:b1:2b:ba
inet6 fe80::5c7e:b7ff:feb1:2bba%en5 prefixlen 64 scopeid 0xe
inet 169.254.99.129 netmask 0xfffc broadcast 169.254.99.131
nd6 options=1PERFORMNUD
media: autoselect (10baseT/UTP full-duplex)
status: active


I can look at avahi-autoipd though.  See what comes from it.

Thank you Ed.

-Alfred
___
freebsd-usb@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to freebsd-usb-unsubscr...@freebsd.org