Bug#495676: hw-detect: hw-detect new device detection misbehaves with wlan* devices

2008-08-24 Thread Frans Pop
 I tried to dig the history of the repository in order to figure out why
 snapshot_dev() used sort in the first place, but I was not able to
 get any meaningful result.  Do anyone have an idea?

The reason for the sort is probably to make the dialog show:
eth0: .
eth1: .
wlan0: .

instead of what I get on my HP 2510p without the sort:
eth0: .
wlan0: .
eth1: .

I must say I'd prefer to not depend on sort orders at all and with the 
removal of the sort statement you still depend implicitly on the sort 
order of /proc/net/dev.

Instead of the proposed sed statement I'd propose to write out 
compare_devs() and just check all devices in a loop, for example 
(untested):
local olddevs=$1
local devs=$2
local newdevs, dev

newdevs=
for dev in $olddevs; do
if ! echo $devs | grep -Eq (^| )$dev( |$); then
newdevs=${newdevs:+$newdevs }$dev
fi
done
echo $newdevs

A bit slower, but that does not really matter here. And it's a lot more 
readable than either current code or the proposed sed statement.

Note that ethdetect is rather obsolete anyway. It still basically assumes 
that modules need to be loaded manually instead of being automatically 
loaded by the kernel/udev...



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#495676: hw-detect: hw-detect new device detection misbehaves with wlan* devices

2008-08-19 Thread Jérémy Bobbio
Package: hw-detect
Version: 1.65
Severity: important

Hi!

While testing a daily image on a Lenovo R61 with a manually updated
2.6.26 image, I was puzzled when I was asked Do you intend to use
FireWire Ethernet? on a machine which has both wired and wireless LAN
cards.

2.6.26 kernels re-introduced the old FireWire stack.  So we are back
having the eth1394 module available, and thus FireWire ethernet.  That's
why the following issue did not pop up before.

After digging through the logs, I eventually found that every single
card was listed as FireWire ethernet in /etc/network/devnames.  Next
step was figuring out why could make that happen.

More tests later, I eventually found that this was due to the way
hw-detect finds a new network interface after loading a module.

The list of available interface is known by snapshot_devs()
after sorting the content of the first column in /proc/net/dev,
e.g. lo eth0.

This list is kept while a new module is loaded, then snapshot_devs() is
called again to get something like lo eth0 eth1.  To compare those
lists and get the new interfaces, compare_devs() is used.

compare_devs() basically currently works by doing:
  echo ${devs#$olddevs}

In the previous case, as ethX interfaces are always added at the end,
both lists have the same start, and so compare_devs() nicely output
eth1.

Unfortunately, thanks to new Wi-Fi stacks, we now have interfaces that
are not named ethX.  On this laptop we get the following:

  compare_devs lo eth0 wlan0 wmaster0 lo eth0 eth1 wlan0 wmaster0
 
   not inserted at the end!

I see two possible fixes here:

 * Stop sorting devices in snapshot_devs() anymore.  I don't see why
   the kernel would reorder the content of /proc/net/dev when new
   modules are inserted.  From my tests, this nicely solved the issue.
 * Make compare_dev() able to detect the addition in the middle of the
   device list.  For the record, modifying compare_devs to use the
   following did the trick:

 sed=$(echo $olddevs | sed -e 's#\([a-z0-9]\+\) *#s/\1 *//;#g')
 echo $devs | sed -e $sed

I tried to dig the history of the repository in order to figure out why
snapshot_dev() used sort in the first place, but I was not able to get
any meaningful result.  Do anyone have an idea?

Otherwise, removing the sorting sounds like the best option to me.

Cheers,
-- 
Jérémy Bobbio.''`. 
[EMAIL PROTECTED]: :Ⓐ  :  # apt-get install anarchism
`. `'` 
  `-   


signature.asc
Description: Digital signature


Bug#495676: hw-detect: hw-detect new device detection misbehaves with wlan* devices

2008-08-19 Thread Otavio Salvador
Jérémy Bobbio [EMAIL PROTECTED] writes:


 I see two possible fixes here:

  * Stop sorting devices in snapshot_devs() anymore.  I don't see why
the kernel would reorder the content of /proc/net/dev when new
modules are inserted.  From my tests, this nicely solved the issue.
  * Make compare_dev() able to detect the addition in the middle of the
device list.  For the record, modifying compare_devs to use the
following did the trick:

  sed=$(echo $olddevs | sed -e 's#\([a-z0-9]\+\) *#s/\1 *//;#g')
  echo $devs | sed -e $sed

 I tried to dig the history of the repository in order to figure out why
 snapshot_dev() used sort in the first place, but I was not able to get
 any meaningful result.  Do anyone have an idea?

 Otherwise, removing the sorting sounds like the best option to me.

I also do not see a reason for it. If noone complains in next days I'd
say for us to go with the sort removal and get it uploaded.

-- 
O T A V I OS A L V A D O R
-
 E-mail: [EMAIL PROTECTED]  UIN: 5906116
 GNU/Linux User: 239058 GPG ID: 49A5F855
 Home Page: http://otavio.ossystems.com.br
-
Microsoft sells you Windows ... Linux gives
 you the whole house.



--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]