OESF | ELSI | pdaXrom | OpenZaurus | Zaurus Themes | Community Links | Ibiblio

IPB

Welcome Guest ( Log In | Register )

2 Pages V  < 1 2  
Reply to this topicStart new topic
> Post Install Tweeks, That would make life easyer
danboid
post Apr 22 2010, 02:28 PM
Post #16





Group: Members
Posts: 682
Joined: 26-December 05
From: Rochdale, Lancashire
Member No.: 8,789



QUOTE(ptoki @ Jul 9 2009, 06:58 PM) *
tweak a bit zaurus leds:
echo mmc0 > /sys/class/leds/spitz\:green\:mail/trigger
echo ide-disk > /sys/class/leds/spitz\:amber\:charge/trigger

if you like put it in /etc/init.d/zaurusd right after echo "starting zaurusd"
this gives you blinking leds while accessing cards.


This would seem to be wrong or at least outdated. If I add

CODE
echo "mmc0" > /sys/class/leds/spitz\:green\:hddacti/trigger


to zaurusd then the green led blinks whilst zubuntu boots then after its booted (ie after running the zaurusd daemon) the green LED only blinks when I access the SD card.

As far as I can tell you can only have one event / device (in this case mmc0 or ide-disk) assigned per LED trigger although under 2.4 based distros my green LED would flash when I accessed either the CF or SD interfaces.

Have I misunderstood or is there a workaround for this?
Go to the top of the page
 
+Quote Post
ptoki
post Apr 25 2010, 11:15 AM
Post #17





Group: Members
Posts: 90
Joined: 1-April 08
From: Silesia
Member No.: 21,583



QUOTE(danboid @ Apr 23 2010, 12:28 AM) *
QUOTE(ptoki @ Jul 9 2009, 06:58 PM) *
tweak a bit zaurus leds:
echo mmc0 > /sys/class/leds/spitz\:green\:mail/trigger
echo ide-disk > /sys/class/leds/spitz\:amber\:charge/trigger

if you like put it in /etc/init.d/zaurusd right after echo "starting zaurusd"
this gives you blinking leds while accessing cards.


This would seem to be wrong or at least outdated. If I add

CODE
echo "mmc0" > /sys/class/leds/spitz\:green\:hddacti/trigger


to zaurusd then the green led blinks whilst zubuntu boots then after its booted (ie after running the zaurusd daemon) the green LED only blinks when I access the SD card.

As far as I can tell you can only have one event / device (in this case mmc0 or ide-disk) assigned per LED trigger although under 2.4 based distros my green LED would flash when I accessed either the CF or SD interfaces.

Have I misunderstood or is there a workaround for this?


Well, I have only c1000 device so I cant tell how other devices behave. I confirm that there is possible to have only one device triggering LED. At least I did not try to echo something else than one trigger name.
Your code is correct and works as should to.
In c1000 there are two leds. And in my case I have two leds for cf and sd card blinking separately.

Additionally I can tell that amber led (charge) is acting problematically. Sometimes it works and sometimes it does not blink even when I am reading files on cf card.
Go to the top of the page
 
+Quote Post
danboid
post Apr 26 2010, 12:22 AM
Post #18





Group: Members
Posts: 682
Joined: 26-December 05
From: Rochdale, Lancashire
Member No.: 8,789



QUOTE(ptoki @ Apr 25 2010, 08:15 PM) *
QUOTE(danboid @ Apr 23 2010, 12:28 AM) *
QUOTE(ptoki @ Jul 9 2009, 06:58 PM) *
tweak a bit zaurus leds:
echo mmc0 > /sys/class/leds/spitz\:green\:mail/trigger
echo ide-disk > /sys/class/leds/spitz\:amber\:charge/trigger

if you like put it in /etc/init.d/zaurusd right after echo "starting zaurusd"
this gives you blinking leds while accessing cards.


This would seem to be wrong or at least outdated. If I add

CODE
echo "mmc0" > /sys/class/leds/spitz\:green\:hddacti/trigger


to zaurusd then the green led blinks whilst zubuntu boots then after its booted (ie after running the zaurusd daemon) the green LED only blinks when I access the SD card.

As far as I can tell you can only have one event / device (in this case mmc0 or ide-disk) assigned per LED trigger although under 2.4 based distros my green LED would flash when I accessed either the CF or SD interfaces.

Have I misunderstood or is there a workaround for this?


Well, I have only c1000 device so I cant tell how other devices behave. I confirm that there is possible to have only one device triggering LED. At least I did not try to echo something else than one trigger name.
Your code is correct and works as should to.
In c1000 there are two leds. And in my case I have two leds for cf and sd card blinking separately.

Additionally I can tell that amber led (charge) is acting problematically. Sometimes it works and sometimes it does not blink even when I am reading files on cf card.


I knew that I could use the amber led to monitor SD activity if I wanted to but I'd rather leave that as a charge indicator.

I can only presume that the Zaurus LED triggering worked differently under 2.4 kernels and you could assign multiple devices to trigger the same LED?
Go to the top of the page
 
+Quote Post
ptoki
post Apr 26 2010, 02:30 AM
Post #19





Group: Members
Posts: 90
Joined: 1-April 08
From: Silesia
Member No.: 21,583



QUOTE(danboid @ Apr 26 2010, 10:22 AM) *
QUOTE(ptoki @ Apr 25 2010, 08:15 PM) *
QUOTE(danboid @ Apr 23 2010, 12:28 AM) *
QUOTE(ptoki @ Jul 9 2009, 06:58 PM) *
tweak a bit zaurus leds:
echo mmc0 > /sys/class/leds/spitz\:green\:mail/trigger
echo ide-disk > /sys/class/leds/spitz\:amber\:charge/trigger

if you like put it in /etc/init.d/zaurusd right after echo "starting zaurusd"
this gives you blinking leds while accessing cards.


This would seem to be wrong or at least outdated. If I add

CODE
echo "mmc0" > /sys/class/leds/spitz\:green\:hddacti/trigger


to zaurusd then the green led blinks whilst zubuntu boots then after its booted (ie after running the zaurusd daemon) the green LED only blinks when I access the SD card.

As far as I can tell you can only have one event / device (in this case mmc0 or ide-disk) assigned per LED trigger although under 2.4 based distros my green LED would flash when I accessed either the CF or SD interfaces.

Have I misunderstood or is there a workaround for this?


Well, I have only c1000 device so I cant tell how other devices behave. I confirm that there is possible to have only one device triggering LED. At least I did not try to echo something else than one trigger name.
Your code is correct and works as should to.
In c1000 there are two leds. And in my case I have two leds for cf and sd card blinking separately.

Additionally I can tell that amber led (charge) is acting problematically. Sometimes it works and sometimes it does not blink even when I am reading files on cf card.


I knew that I could use the amber led to monitor SD activity if I wanted to but I'd rather leave that as a charge indicator.

I can only presume that the Zaurus LED triggering worked differently under 2.4 kernels and you could assign multiple devices to trigger the same LED?

I have no idea. I think (but dont have any hard base on it) that in 2.4 kernel green led was used by some sort proprietary code to show any activity.

But just got an idea.
Try to look in /proc and /sys and search for interrupts information. I took numbers from /proc/interrupts or similar.
I did screensaver replacement for zubuntu on c1000 by looking number of interrupts generated by keyboard to put zaurus to sleep after some time without keypress (and touch screen taps) but only when mpd is stopped/paused.

I grepped file with interrups cuted number of them and compared with the same file after some sleep.

You can do the same to the led. Just grep interrupts or counters for cf, sd, network, put those in variable and sleep 1 sec.
If numbers change do a blink led.
It will be much less responsive but will act as you expect.

I will try to post my sleep script in a few days (im away from zaurus).
Go to the top of the page
 
+Quote Post
danboid
post Apr 29 2010, 07:58 AM
Post #20





Group: Members
Posts: 682
Joined: 26-December 05
From: Rochdale, Lancashire
Member No.: 8,789



Hi ptoki!

I'm not quite sure what you mean so it'd be great if you could post your sleep script and explain how it could be modified to work with the LEDs

Thanks!
Go to the top of the page
 
+Quote Post
ptoki
post May 1 2010, 01:14 AM
Post #21





Group: Members
Posts: 90
Joined: 1-April 08
From: Silesia
Member No.: 21,583



Here is my script:
CODE
#!/bin/sh
ONE=$(grep Spitzkbd /proc/interrupts|md5sum)
while true
do
sleep 240
PLAYING=$(mpc|grep "play"|wc -l)
if [ "$PLAYING" = 0 ]; then
TWO=$(grep "Spitzkbd\|ts" /proc/interrupts|md5sum)
#echo $ONE $TWO
if [ "$ONE" = "$TWO" ]; then
apm -s
fi
fi
ONE=$TWO
done


File with interrupts (/proc/interrupts) looks like this:
CODE
CPU0
3: 1240 SC ohci_hcd:usb1
6: 12 SC pxa_i2c-i2c.1
11: 0 SC pxa27x_udc
16: 0 SC SSP
17: 34 SC LCD
18: 2214 SC pxa_i2c-i2c.0
23: 158689 SC pxa2xx-mci
25: 17071 SC DMA
26: 295976 SC ost0
73: 0 GPIO MMC card detect
75: 40 GPIO ts
76: 87 GPIO Spitzkbd Sense
77: 0 GPIO Spitzkbd HP Type, sharpsl_rc
80: 0 GPIO Spitzkbd Sync
81: 77 GPIO Spitzkbd Sense
85: 0 GPIO Fatal Battery
98: 56 GPIO Spitzkbd Sense
100: 79 GPIO Spitzkbd Sense
102: 158 GPIO Spitzkbd Sense
103: 763 GPIO Spitzkbd Sense
154: 0 GPIO Battery Cover
155: 82 GPIO Spitzkbd Sense
158: 0 GPIO PCMCIA0 CD
159: 30 GPIO Spitzkbd PwrOn
160: 23 GPIO Spitzkbd SWB
161: 4 GPIO Spitzkbd SWA
165: 0 GPIO CO
169: 10693 GPIO ide0
179: 0 GPIO AC Input Detect
180: 0 GPIO Spitzkbd HP
Err: 0

I think ide0 contains number of interrupts for cf card and pxa2xx-mci contains number of interrupts for sd card.

If you want to check activity of network card just check output of ifconfig and look for eth0, ppp0 wifi activity represented by number of bytes,sent/received.

In my case it was not important how much keys was pressed i just needed to know if anything happened so i used md5sum to check that.

There is a lot of ways to achieve result which You need, just peek in /proc or /sys and with simple script monitor what is happening in those files while You are doodling with zaurus and then write script to use that information and react.
You can use beeping instead led flash. Or you can try aosd_cat as a OSD visualizer.


I have written a small utility to show vital signs of my zaurus. I connected it to a keypress using .xbindkeysrc:
Look at "#show" battery section. When you press FN and 0 (zero) then /bin/batt script is executed.
Also Fn+9 is mpd toggle and fn+8 and Fn+7 is next and prev song

CODE
###########################
# xbindkeys configuration #
###########################
#
# Version: 0.1.3
#
# If you edit this, do not forget to uncomment any lines that you change.
# The pound(#) symbol may be used anywhere for comments.
#
# A list of keys is in /usr/include/X11/keysym.h and in
# /usr/include/X11/keysymdef.h
# The XK_ is not needed.
#
# List of modifier (on my keyboard):
# Control, Shift, Mod1 (Alt), Mod2 (NumLock),
# Mod3 (CapsLock), Mod4, Mod5 (Scroll).
#
# Another way to specifie a key is to use 'xev' and set the
# keycode with c:nnn or the modifier with m:nnn where nnn is
# the keycode or the state returned by xev
#
# This file is created by xbindkey_config
# The structure is :
# # Remark
# "command"
# m:xxx + c:xxx
# Shift+...




#keystate_numlock = enable
#keystate_scrolllock = enable
#keystate_capslock = enable



#Brigtness Down
"display-brightness.sh down"
m:0x40 + c:12
Mod4 + 3

#Brightness Up
"display-brightness.sh up"
m:0x40 + c:13
Mod4 + 4

#Volume Down
"pcm down"
m:0x40 + c:10
Mod4 + 1
"pcm down"
F19

#Volume Up
"pcm up"
m:0x40 + c:11
Mod4 + 2
"pcm up"
F20

#show battery
"/bin/batt osd"
m:0x40 + c:19
Mod4 + 0

#toggle mpd
"mpc toggle"
m:0x40 + c:18
Mod4 + 9
"mpc toggle"
F18

#prev mpd
"mpc prev"
m:0x40 + c:16
Mod4 + 7

#next mpd
"mpc next"
m:0x40 + c:17
Mod4 + 8


#Right Mouse Click
"xte 'mouseclick 3'"
Control + b:1 (mouse)

#middle mouse click
"xte 'mouseclick 2'"
Shift + b:1

#rotate
"/bin/rot"
F10

"xte 'key Delete'"
Mod4 + c:22
#

#f1
#"xte 'key f1'"
# Mod4 + 1

#rotate screen
"/bin/rot"
m:0x40 + c:15

#fake alt-tab
"xte 'keydown Alt_L' 'key Tab' 'keyup Alt_L'"
c:67
"xte 'keydown Alt_L' 'key Tab' 'keyup Alt_L'"
F17

#fake alt-f4
"xte 'keydown Alt_L' 'key F4' 'keyup Alt_L'"
c:96

#show desktop
"xte 'keydown Alt_L' 'key l' 'keyup Alt_L'"
c:107

#
# End of xbindkeys configuration


It is helpful to use xev to check which codes are generated by X while pressing keyboard keys.

Here is a batt script:
It shows some nice information about Z

CODE
#!/bin/sh

a=$(cat /sys/devices/platform/sharpsl-pm/battery_percentage)
f=$( free|grep Mem|awk '{ print $1 int($4/1024) }'|tail -n 3|tr "\n" " ")
l=$(top -b -n 1|grep "load average"|cut -d "," -f 3-6|cut -d ":" -f 2)
d=$(date)
s=$(amixer sget PCM|grep "\["|cut -d " " -f 4,6)


TEKST=$(echo -e "PCM\n$s\n$d\nbatt:$a \n$f \nload:$l")

echo -e "batt:$a $f load:$l"
if [ "$1" = "osd" ]; then
aosd_cat -d 5000 -e 0 -F "Trebuchet 30" -s 3 -S 100 -r 1 -g 1 -b 0 -x 30 -y 30 -t "$TEKST"
fi

And one more:
CODE
pcm script (used to change volume)

#!/bin/sh


STEP=3

if [ ! -n "$1" ]; then
echo "max / current"
amixer sget PCM
elif [ "$1" = "up" ]; then
amixer sset PCM $STEP"%+"
elif [ "$1" = "down" ]; then
amixer sset PCM $STEP"%-"
else
echo -e "\nUsage:\n\t `basename $0` [up | down]\n"
fi


And if I remember correctly I have changed slightly standard zubuntu script to change display brightness.

CODE
#!/bin/sh

# display-brightness.sh
# simple script to set display-brightness for zaurus clamshell
# author: patrick steiner <[EMAIL PROTECTED]>
# modified by: Ian Munsie <[EMAIL PROTECTED]>
# modified by: Paul M "speculatrix" - for Spitz/Zubuntu
# version: 1.02 | 15/12/2008 21:48 GMT

STEP=5
MAX_BRIGHTNESS=47
MIN_BRIGHTNESS=0

DRIVER="`ls /sys/class/backlight/|head -n 1`"
BRIGHTNESS_FILE="/sys/class/backlight/$DRIVER/brightness"
BRIGHTNESS=`cat /sys/class/backlight/$DRIVER/actual_brightness`
# this gives bad number - 15 is max, 16 is off!
#MAX_BRIGHTNESS=`cat /sys/class/backlight/$DRIVER/max_brightness`

POWER_FILE="/sys/class/backlight/$DRIVER/bl_power"
POWER_ON=0
#POWER_OFF=1


if [ ! -n "$1" ]; then
echo "max / current"
echo "$MAX_BRIGHTNESS / $BRIGHTNESS"
elif [ "$1" = "up" ]; then
test -x /usr/bin/bl && bl on
echo $POWER_ON >> $POWER_FILE
if [ $BRIGHTNESS -lt $MAX_BRIGHTNESS ]; then
let BRIGHTNESS=$BRIGHTNESS+$STEP
if [ $BRIGHTNESS -ge $MAX_BRIGHTNESS ]; then
let BRIGHTNESS=$MAX_BRIGHTNESS
fi
echo $BRIGHTNESS >> $BRIGHTNESS_FILE
fi
elif [ "$1" = "down" ]; then
test -x /usr/bin/bl && bl on
echo $POWER_ON >> $POWER_FILE
if [ $BRIGHTNESS -gt $MIN_BRIGHTNESS ]; then
let BRIGHTNESS=$BRIGHTNESS-$STEP
if [ $BRIGHTNESS -le $MIN_BRIGHTNESS ]; then
let BRIGHTNESS=$MIN_BRIGHTNESS
fi
echo $BRIGHTNESS >> $BRIGHTNESS_FILE
fi
elif [ "$1" = "off" ]; then
if [ $BRIGHTNESS -ne 0 ];then
echo "$BRIGHTNESS" >/tmp/backlight
echo 0 > $BRIGHTNESS_FILE
fi
elif [ "$1" = "on" ]; then
cat /tmp/backlight > $BRIGHTNESS_FILE
rm /tmp/backlight
else
echo -e "\nUsage:\n\t `basename $0` [up | down]\n"
fi


Combined together with .xbindkeyrc, those give quite nice result in usability of the zaurus. Dont forget ro run xbindkeys in your ./homedir/.xinitrc. the saver script is also executed there with background option (& ampersand at the end of a command)
BTW I use matchbox WM so there is not much to put in panel to monitor OS condition thats why i have those scripts.
Aosd_cat is quite slow to start but I use it rarely so it is not a problem.
Go to the top of the page
 
+Quote Post

2 Pages V  < 1 2
Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 23rd October 2014 - 09:53 AM