Re: [Slightly-OT] On usability: managing usb devices network profiles in a ion3 environment

2009-03-09 Thread Tuomo Valkonen
On 2009-03-07, Mico Filós elmico.fi...@gmail.com wrote:
 Thank you all for your feedback. I will play with the scripts a little...

While you're at it, write ion-power-manager. Something simple 
and reliable to replace the awful bloated and complicated 
gnome and kde crap. No fucking HAL crap; just talk to /sys,
acpi, whatever. Can be Thinkpad-specific. Indeed probably 
should be based on plugins specific to particular computer
models or classes instead of over-engineered low-level 
abstr^Windirection.

(I tried reading the gnome-power-damager code to see how it works... 
with the effort I put into it, I couldn't make heads and tails
of how it's interacting with other HAL/DBus crap; how the XSync 
extension is supposed to keep track of idle times -- the documentation
of the extension is poor at best -- if it is supposed to do that. 
You have to trace a gazillion levels of indirection.

I'd probably just use the screensaver extension for idle timing, 
if it can be tricked into multiple timeouts. After all, you want
to run the screen lock _before_  suspend/hibernate; the scripts
should synchronise the locking program startup, or just include
the screen lock in the power manager. The Gnome crap doesn't do 
this, and all the system-level scripts have finished restoring 
the system from suspension -- when all the sun spots are correctly
aligned and it all works -- before it seems to run the locker, 
which is a big gleaming security black hole.

But it's a lot of work to do all that, and for now Windows mostly
works for me. I'm really liking _reliable_ suspend and hibernate
in Windowsland, foobar2k, undervolting -- even that requires a fucking
kernel patch on the piece of shit Linux -- etc. Finally even managed
to get locales/UTF-8 working in Cygwin: the trick is to use
LC_CTYPE=C-UTF-8.UTF-8. The biggest problem ATM is getting a cygwin
version of darcs. If it doesn't work out, I may have to switch to 
Mercurial for Ion and my other projects.)

-- 
In 1995, Linux was almost a bicycle; an alternative way of live to the
Windows petrol beasts that had to be taken to the dealer for service.
By 2008, Linux has bloated into a gas-guzzler, and local vendors and
artisans have had to yield to all under one roof big box hypermarkets.



Re: [Slightly-OT] On usability: managing usb devices network profiles in a ion3 environment

2009-03-07 Thread Mico Filós
Thank you all for your feedback. I will play with the scripts a little...


Re: [Slightly-OT] On usability: managing usb devices network profiles in a ion3 environment

2009-03-03 Thread Evgeny Kurbatov
Hi, Mico!

I'm risking to get a pail of slops on my head but stupid, braindead,
shit-styled, awful, G*d damned, and despite this widely used desktop
environments like *nome, *DE, *FCE etc are much more user friendly than
progressive (and marginal, be honest) ones.  I use Ion since 2nd
release and quite bored to fix daughter windows properties for some
poorly designed (actually just not Ion-designed) applications.  Last
times I run *nome-panel before Ion in my .xsession to get a bit of
usability and comfortable mounting also.

I like Ion.  I like its minimalism.  But actually I like the
possibility to create/destroy as much desktops as I want and make it
dynamically.  That is all I really need.  Now I'm looking for
possibility of this in *nome DE or FVWM, which can be runned beneath
*nome DE.  If I'd do, I'll leave Ion forever.  Man must be ready for
hard decisions, yeah...


On Tue, 3 Mar 2009 00:29:06 -0500
Mico Filós elmico.fi...@gmail.com wrote:

 Hi,
 
 I am just curious to know what do ion3 users do to manage painlessly
 usb devices and network profiles.
 
 I've done my tinkering with udev to configure my usb gadgets, but when
 I have to read others' pendrives I simply spend an embarassingly long
 time trying to figure out what node the device is attached to (plus
 additional time spent on mount points  permissions issues). I've
 heard that graphical environments like gnome or kde do that quite
 automatically, but I don't see why a non-graphical environment could
 not do the same thing.
 
 The same goes for managing network profiles in a laptop. Gnome has
 network-manager, a graphical tool that seems to do a good job. Again,
 there is no need to rely on a widget to do this kind of task, but I
 haven't found yet a convincing non-graphical solution.
 
 Any ideas?
 
 Best


Re: [Slightly-OT] On usability: managing usb devices network profiles in a ion3 environment

2009-03-03 Thread Vladimir Skuratovich
Hi,

It seems that with USB sticks the only option you have (apart from
finding and mounting them manually) is HAL-based automounting, for
example, HAL + ivman + pmount. Then you can add some nice tricks with
mod_ionflux, for example, create a menu with all mounted drives and
commands to unmount  eject them.

With network profiles you actually have a lot of options, starting from
ifupdown scripts in Debian, where you can specify a profile manually,
through 'divine', a nice small program that is able to send ARP requests
to specified hosts to check if they are on the network and then
configure the interface, to 'guessnet' - a plug-in for ifupdown, which
can do the same things as 'divine' and some more.

While the last configuration (ifupdown + guessnet) is quite complex to
set up, it offers you the most flexibility - for example. your laptop
can select network profiles based on the ESSID of the Wi-Fi access point
you are connected to, or on the presence of specific hosts on the wired
network, and you can always override the selection manually.


On Tue, Mar 03, 2009 at 12:29:06AM -0500, Mico Filós wrote:
 Hi,
 
 I am just curious to know what do ion3 users do to manage painlessly
 usb devices and network profiles.
 
 I've done my tinkering with udev to configure my usb gadgets, but when
 I have to read others' pendrives I simply spend an embarassingly long
 time trying to figure out what node the device is attached to (plus
 additional time spent on mount points  permissions issues). I've
 heard that graphical environments like gnome or kde do that quite
 automatically, but I don't see why a non-graphical environment could
 not do the same thing.
 
 The same goes for managing network profiles in a laptop. Gnome has
 network-manager, a graphical tool that seems to do a good job. Again,
 there is no need to rely on a widget to do this kind of task, but I
 haven't found yet a convincing non-graphical solution.
 
 Any ideas?
 
 Best


Re: [Slightly-OT] On usability: managing usb devices network profiles in a ion3 environment

2009-03-03 Thread Tuomo Valkonen
On 2009-03-03, Vladimir Skuratovich skuratov...@gmail.com wrote:
 With network profiles you actually have a lot of options, starting from
 ifupdown scripts in Debian, where you can specify a profile manually,
 through 'divine', a nice small program that is able to send ARP requests
 to specified hosts to check if they are on the network and then
 configure the interface, to 'guessnet' - a plug-in for ifupdown, which
 can do the same things as 'divine' and some more.

NetworkManager (and its applet) are one of the few things that actually
didn't totally suck abount Xubuntu. Could even get VPN working with less
effort than Windows. (F-secure + Cisco VPN client - BSOD, if you install
them in that order. The only one I've had, while Linux has locked up many
times on console switches etc.) Otherwise, can't say much good about 
wireless in Xubuntu: all the radios blasting at full power on startup, 
have to manually turn them off, instead of it remembering the settings.  
And in 8.04 the Fn-key radio button just toggled the first device of
wifi/bluetooth, while in 8.10 it cycles through the combos without  
indicating the current choice: bluetooth led works, but wifi led doesn't.
In Windows I get a nice popup where to turn radios on/off, and it 
remembers the settings.

(As a temporary measure, I've been just running the XFCE panel as 
Ion's stdisp for all the systray shit. But it sucks, because it 
can't align stuff to the right in the non-fullwidth mode.)

-- 
Stop Gnomes and other pests! Purchase Windows today!



Re: [Slightly-OT] On usability: managing usb devices network profiles in a ion3 environment

2009-03-03 Thread Antonio De Leon
On the question of detecting usb devices this tool can help on the
detection part.


lookfor-sd-devs.sh
Description: Bourne shell script


Re: [Slightly-OT] On usability: managing usb devices network profiles in a ion3 environment

2009-03-03 Thread Tuomo Valkonen
On 2009-03-03 17:21 -0500, Antonio De Leon wrote:
 On the question of detecting usb devices this tool can help on the
 detection part.

Here's my ls-removable script too. It's in Lua, and needs
both luafilesystem and posix packages for Lua.

There are two versions. The suffix-1 version worked with
the old 2.6.18 or whateveritwas Etch. Suffix-2 is a
conversion to work the modified /sys layout in *buntu 8.10,
but it fails to work because pmount doesn't seem to have
been upgraded to to reflect that. It, however, shouldn't be
too difficult to create a suid-root counterpart based on my
code, that just calls mount -- this time with sane FAT and
NTFS mounting arguments.

(*sigh*, even the ntfs-3g in 8.10 ubuntu is old, and does
not seem to support .NTFS-3G/UserMapping. A lot of shit in
it is _old_, and yet it has just half-a-year release
cycles.)

-- 
[Fashion] is usually a form of ugliness so intolerable that we have
 to alter it every six months. -- Oscar Wilde
The computer industry is the only industry that is more fashion-driven
 than women's fashion. -- RMS


#!/usr/local/bin/lua
--
-- Copyright (c) Tuomo Valkonen 2008.
--

require('lfs')
require('posix')

local function filtered_dir(d) 
local f, s_, v_ = lfs.dir(d)
local function g(s, v)
while true do
local vn=f(s, v)
if vn~='.' and vn~='..' then
return vn
end
end
end
return g, s_, v_
end

local function readfile(d)
local f, err = io.open(d, 'r')
if f then
local s=f:read('*a')
f:close()
return s
end
end

local function simplify_string(s)
if s then
return string.gsub(s, \n$, )
end
end

local function readfile_simple(d)
return simplify_string(readfile(d))
end

local function removable(d)
return readfile_simple(d../removable)==1;
end

local function removable_class(d)
-- Super-dirty hack
return d and string.match(d, /usb%d+/)
end

local function simplify_path(p)
local capts={}
local start=string.match(p, ^(/))
string.gsub(p, ([^/]+),
   function(e)
   if e==.. and #capts  1 then
   capts[#capts]=nil
   elseif e~=. then
   table.insert(capts, e)
   end
end) 
return (start or )..table.concat(capts, /)
end

local function get_device(d)
l=posix.readlink(d../device)
if not l then
return nil
end
if string.match(l, ^.) then
return simplify_path(d../..l)
else
return simplify_path(l)
end
end

local function get_info(dev)
return {
vendor=readfile_simple(dev../vendor),
model=readfile_simple(dev../model),
serial=readfile_simple(dev../serial)
}
end

local function get_info_usb(dev)
par=string.match(dev, (.*)/[^/]+)
if not par then
return {}
else
local m=readfile_simple(par../manufacturer)
if not m then
return get_info_usb(par)
else
return {
vendor=m,
model=readfile_simple(par../product),
serial=readfile_simple(par../serial)
}
end
end
end

local function scan_volumes(bd, d)
local function g()
local found=false
for v in filtered_dir(bd..d) do
if string.match(v, ^..d..%d+$) then
coroutine.yield(v)
found=true
end
end
if not found then
coroutine.yield(d)
end
end

return coroutine.wrap(g)
end



local mounts={}
--local mounts_=io.popen(mount):read('*a')
--string.gsub(mounts_, [^\n]+, function(l) table.insert(mounts, l) end)
local f=io.open(/etc/mtab)
for l in f:lines() do
table.insert(mounts, l)
end
f:close()

local function mounted(v)
for _, l in ipairs(mounts) do
local mp=string.match(l, ^/dev/..v..%s+([^%s]+))
if mp then
return mp
end
end
return false
end

local bd='/sys/block/'

local volumes={}

for d in filtered_dir(bd) do
local dev=get_device(bd..d)
if removable(bd..d) or removable_class(dev) then
local i1=get_info(dev)
local i2=get_info_usb(dev)

if i2 and i2.vendor then
info=table.concat({i2.vendor, i2.model, i2.serial},  )
else
info=table.concat({i1.vendor, i1.model, i1.serial},  )
end

for v in scan_volumes(bd, d) do
table.insert(volumes, {
kernel=v,
info=info,
mountpoint=mounted(v),
})
end
end
end

table.sort(volumes,
   function(a, b) 
   if a.mountpoint and not b.mountpoint then
   return false
   elseif not a.mountpoint and b.mountpoint then
   return true
   else
   return (a.kernel  b.kernel)