You are not logged in.

#126 2009-05-11 20:43:14

genisis300
Member
From: Uk
Registered: 2008-01-15
Posts: 284

Re: Batterymon -- a simple battery monitor ideal for openbox etc

i was just going to point that out it has been fixed for the next release which will be out in a couple of days.

Sorry sad


although that shouldn't crash the program

i would try what Laz has suggested

Last edited by genisis300 (2009-05-11 20:45:00)


"is adult entertainment killing our children or is killing our children entertaining adults?" Marilyn Manson

Offline

#127 2009-05-11 22:20:12

SiD
Member
From: Germany
Registered: 2006-09-21
Posts: 729

Re: Batterymon -- a simple battery monitor ideal for openbox etc

Lars Stokholm wrote:

@SiD: The exception has nothing to do with libnotify, but try sending the output of 'lshal -u `hal-find-by-capability --capability battery`'. It seems you're missing "battery.rechargeable.is_charging".

Hmm, there is no "battery.rechargeable.is_charging" in the output of 'lshal -u `hal-find-by-capability --capability battery`'

$ lshal -u `hal-find-by-capability --capability battery`

udi = '/org/freedesktop/Hal/devices/computer_power_supply_battery_BAT1'
  battery.present = false  (bool)
  battery.type = 'primary'  (string)
  info.capabilities = {'battery'} (string list)
  info.category = 'battery'  (string)
  info.parent = '/org/freedesktop/Hal/devices/computer'  (string)
  info.product = 'Generic Battery Device'  (string)
  info.subsystem = 'power_supply'  (string)
  info.udi = '/org/freedesktop/Hal/devices/computer_power_supply_battery_BAT1'  (string)
  linux.hotplug_type = 2  (0x2)  (int)
  linux.subsystem = 'power_supply'  (string)
  linux.sysfs_path = '/sys/devices/LNXSYSTM:00/device:00/PNP0A03:00/device:0c/PNP0C09:00/ACPI0001:00/ACPI0002:00/power_supply/BAT1'  (string)

Offline

#128 2009-05-11 22:31:28

Lars Stokholm
Member
From: Denmark
Registered: 2009-03-17
Posts: 223

Re: Batterymon -- a simple battery monitor ideal for openbox etc

@SiD: There is no battery present on BAT1... Try 'lshal /org/freedesktop/Hal/devices/computer_power_supply_battery_BAT0'. If that's you're battery, then we just have to find out why batterymon is selecting the wrong one. It's probably because it just selects any battery like my previous command would, instead of finding "the right one". 'hal-find-by-capability --capability battery' gives you more than one battery, right?

Anywho, I have to sleep now, but I'll check in again some time tomorrow. smile

Edit: Hmm, or should batterymon show both batteries? Does it check to see if batteries are present before trying to show them? *sleep*

Last edited by Lars Stokholm (2009-05-11 22:37:44)

Offline

#129 2009-05-11 22:59:10

SiD
Member
From: Germany
Registered: 2006-09-21
Posts: 729

Re: Batterymon -- a simple battery monitor ideal for openbox etc

Lars Stokholm wrote:

'hal-find-by-capability --capability battery' gives you more than one battery, right?

yes, BAT0 and BAT1

seems BAT0 is my battery

$ lshal -u /org/freedesktop/Hal/devices/computer_power_supply_battery_BAT0
udi = '/org/freedesktop/Hal/devices/computer_power_supply_battery_BAT0'
  battery.charge_level.current = 39930  (0x9bfa)  (int)
  battery.charge_level.design = 65120  (0xfe60)  (int)
  battery.charge_level.last_full = 48460  (0xbd4c)  (int)
  battery.charge_level.percentage = 61  (0x3d)  (int)
  battery.charge_level.rate = 544  (0x220)  (int)
  battery.is_rechargeable = true  (bool)
  battery.model = '04ZL'  (string)
  battery.present = true  (bool)
  battery.rechargeable.is_charging = false  (bool)
  battery.rechargeable.is_discharging = false  (bool)
  battery.reporting.current = 39930  (0x9bfa)  (int)
  battery.reporting.design = 65120  (0xfe60)  (int)
  battery.reporting.last_full = 48460  (0xbd4c)  (int)
  battery.reporting.rate = 544  (0x220)  (int)
  battery.reporting.technology = 'Li-ion'  (string)
  battery.reporting.unit = 'mWh'  (string)
  battery.technology = 'lithium-ion'  (string)
  battery.type = 'primary'  (string)
  battery.vendor = 'SMP-SONY'  (string)
  battery.voltage.current = 15937  (0x3e41)  (int)
  battery.voltage.design = 14800  (0x39d0)  (int)
  battery.voltage.unit = 'mV'  (string)
  info.capabilities = {'battery'} (string list)
  info.category = 'battery'  (string)
  info.parent = '/org/freedesktop/Hal/devices/computer'  (string)
  info.product = '04ZL'  (string)
  info.subsystem = 'power_supply'  (string)
  info.udi = '/org/freedesktop/Hal/devices/computer_power_supply_battery_BAT0'  (string)
  linux.hotplug_type = 2  (0x2)  (int)
  linux.subsystem = 'power_supply'  (string)
  linux.sysfs_path = '/sys/devices/LNXSYSTM:00/device:00/PNP0A03:00/device:0c/PNP0C09:00/ACPI0001:00/ACPI0002:00/power_supply/BAT0'  (string)

Offline

#130 2009-05-11 23:47:56

genisis300
Member
From: Uk
Registered: 2008-01-15
Posts: 284

Re: Batterymon -- a simple battery monitor ideal for openbox etc

the script has never been tested on a system with more than one battery because niether of us have a dual battery system.

although by the look of the 1st output your system is showing Bat1 as not being present? do you know if that is true?

i might be able to fix the code so that it checks if the battery is present and if so shows an icon for each battery...

i'll have a look at the code tomorrow

thank you for posting that output smile

Last edited by genisis300 (2009-05-11 23:48:32)


"is adult entertainment killing our children or is killing our children entertaining adults?" Marilyn Manson

Offline

#131 2009-05-12 00:13:00

SiD
Member
From: Germany
Registered: 2006-09-21
Posts: 729

Re: Batterymon -- a simple battery monitor ideal for openbox etc

genisis300 wrote:

although by the look of the 1st output your system is showing Bat1 as not being present? do you know if that is true?

Hmm, there is only one battery thst I can physicaly remove from my laptop.
It think it's a smart battery, because I need the 'sbs' kernel module.

Offline

#132 2009-05-12 03:54:02

froli
Member
From: Germany
Registered: 2008-06-17
Posts: 455

Re: Batterymon -- a simple battery monitor ideal for openbox etc

@Eax Do you know if you're be able to post a new release of your theme soon? I'm missing it right now sad It doesn't work with the new version of batterymon...

Take your time if you have more important things to do though tongue


archlinux on Macbook Pro 10,1

Offline

#133 2009-05-13 08:37:00

Eax
Member
From: Denmark
Registered: 2009-02-04
Posts: 40
Website

Re: Batterymon -- a simple battery monitor ideal for openbox etc

@froli: Just have to make it first wink

It's examn time at my school these days so I'm a little stressed :S

Offline

#134 2009-05-13 10:48:17

froli
Member
From: Germany
Registered: 2008-06-17
Posts: 455

Re: Batterymon -- a simple battery monitor ideal for openbox etc

Eax wrote:

@froli: Just have to make it first wink

It's examn time at my school these days so I'm a little stressed :S

I know how bad it is, so take your time tongue


archlinux on Macbook Pro 10,1

Offline

#135 2009-05-13 16:51:04

genisis300
Member
From: Uk
Registered: 2008-01-15
Posts: 284

Re: Batterymon -- a simple battery monitor ideal for openbox etc

Eax i'd be willing to lend a hand if you need it smile

Regards
Matthew


"is adult entertainment killing our children or is killing our children entertaining adults?" Marilyn Manson

Offline

#136 2009-05-13 22:25:48

nawitus
Member
Registered: 2009-05-11
Posts: 112

Re: Batterymon -- a simple battery monitor ideal for openbox etc

nawi ~/builds/batterymon $ ./batterymon.py 
Traceback (most recent call last):
  File "./batterymon.py", line 3, in <module>
    import dbus
ImportError: No module named dbus
nawi ~/builds/batterymon $

I have HAL so it should start dbus, right?

Offline

#137 2009-05-14 00:33:29

genisis300
Member
From: Uk
Registered: 2008-01-15
Posts: 284

Re: Batterymon -- a simple battery monitor ideal for openbox etc

i think you need to install dbus-python


"is adult entertainment killing our children or is killing our children entertaining adults?" Marilyn Manson

Offline

#138 2009-05-14 09:08:35

nawitus
Member
Registered: 2009-05-11
Posts: 112

Re: Batterymon -- a simple battery monitor ideal for openbox etc

genisis300 wrote:

i think you need to install dbus-python

Thank you, it is working now!
EDIT:
If I run from ./batterymon.py, it works.
I then did 'sudo link ~/builds/batterymon/batterymon.py /usr/bin/batterymon'
Then I get the error

nawi ~ $ batterymon
Traceback (most recent call last):
  File "/usr/bin/batterymon", line 12, in <module>
    from preferences import prefs
ImportError: No module named preferences

I tried to add batterymon.py in my startups programs in XFCE, but nothing started. How can I install this to start up everytime on boot?

Last edited by nawitus (2009-05-14 09:19:09)

Offline

#139 2009-05-14 11:48:25

genisis300
Member
From: Uk
Registered: 2008-01-15
Posts: 284

Re: Batterymon -- a simple battery monitor ideal for openbox etc

you can install batterymon from Aur which creates the symlink /usr/bin/batterymon

[urlhttp://aur.archlinux.org/packages.php?ID=24694][/url]

i'm working on adding dist setup which will get rid of the problem your having at the moment.

if you install from the Aur it should work just running batterymon.

i would also check that you have all the other python files preferences etc under your ~/build/batterymon directory as that it was it can't load.

Regards
Matthew


"is adult entertainment killing our children or is killing our children entertaining adults?" Marilyn Manson

Offline

#140 2009-05-14 12:11:49

nawitus
Member
Registered: 2009-05-11
Posts: 112

Re: Batterymon -- a simple battery monitor ideal for openbox etc

genisis300 wrote:

you can install batterymon from Aur which creates the symlink /usr/bin/batterymon

[urlhttp://aur.archlinux.org/packages.php?ID=24694][/url]

i'm working on adding dist setup which will get rid of the problem your having at the moment.

if you install from the Aur it should work just running batterymon.

i would also check that you have all the other python files preferences etc under your ~/build/batterymon directory as that it was it can't load.

Regards
Matthew

It's working now properly.

Offline

#141 2009-05-15 08:09:42

genisis300
Member
From: Uk
Registered: 2008-01-15
Posts: 284

Re: Batterymon -- a simple battery monitor ideal for openbox etc

i've uploaded a new PKGBUILD to the AUR to fix the problems highlighted in this thread smile
i plan a new release for the next few days
Let me know how you get on

Regards
Matthew


"is adult entertainment killing our children or is killing our children entertaining adults?" Marilyn Manson

Offline

#142 2009-05-15 08:11:45

genisis300
Member
From: Uk
Registered: 2008-01-15
Posts: 284

Re: Batterymon -- a simple battery monitor ideal for openbox etc

on a side note i've been looking at python dist-utils and although it looks pretty good the only thing that i don't like is that it fragments the code across lots of different dirs.

Is there any problem keeping it the way it is at the moment? i think it's neater to keep all the files etc under one location (excluding the symlink)


"is adult entertainment killing our children or is killing our children entertaining adults?" Marilyn Manson

Offline

#143 2009-06-28 09:20:36

NeoXP
Member
From: MS Matrix
Registered: 2009-01-09
Posts: 206
Website

Re: Batterymon -- a simple battery monitor ideal for openbox etc

Hello everyone,

I'm trying to understand how to get my system to hibernate at critical power-level, but I can't get it to work.

When I start the program using "batterymon -e pm-hibernate" I get an error that only root can run this utillity. When I start the program with sudo I get no errors, but my system inmediately hibernates and keeps doing so untill the process is killed.

Can someone point me in the right direction?

Edit typo

Last edited by NeoXP (2009-06-28 09:20:57)


Arch x86_64 on HP 6820s and on HP nx9420. Registered Linux User 350155, since 24-03-2004
"Everyone said that it could not be done, until someone came along who didn't know that."

Offline

#144 2009-06-29 20:03:39

jerryluc
Member
From: Norway
Registered: 2008-05-20
Posts: 95

Re: Batterymon -- a simple battery monitor ideal for openbox etc

what about an icon for "no batteries" discovered?

Offline

#145 2009-06-29 21:02:49

genisis300
Member
From: Uk
Registered: 2008-01-15
Posts: 284

Re: Batterymon -- a simple battery monitor ideal for openbox etc

Neon Xp you need to look add that command to the sudos file

off the top of my head i think you need to put in quotations 'sudo pm-hibernate' i'll check this when i'm back home.

jerryluc been a bit busy with things at the moment but i have a list of things i want to add to this project and i will get this done soon smile

Regards
Matthew


"is adult entertainment killing our children or is killing our children entertaining adults?" Marilyn Manson

Offline

#146 2009-06-30 19:39:16

NeoXP
Member
From: MS Matrix
Registered: 2009-01-09
Posts: 206
Website

Re: Batterymon -- a simple battery monitor ideal for openbox etc

@genisis300:

No rush, take your time. For now I have an other script taking care op suspending at critical battery-level, but I want to stop using this script in the future.


Arch x86_64 on HP 6820s and on HP nx9420. Registered Linux User 350155, since 24-03-2004
"Everyone said that it could not be done, until someone came along who didn't know that."

Offline

#147 2009-06-30 21:39:57

kremso
Member
Registered: 2008-06-17
Posts: 14

Re: Batterymon -- a simple battery monitor ideal for openbox etc

Yeah, you definitely need to quote the command. Although it doesn't seem like a problem in your case. Also try something like -c 10 if the quotes don't help.

Offline

#148 2009-07-10 14:34:22

grobister
Member
From: Johannesburg
Registered: 2007-05-11
Posts: 4
Website

Re: Batterymon -- a simple battery monitor ideal for openbox etc

Thanks for the effort guys... this is exactly the little tool I was looking for :-)


Grobister

Offline

#149 2009-07-17 20:49:45

gabe_
Member
From: Grand Rapids, MI, US
Registered: 2009-07-17
Posts: 18

Re: Batterymon -- a simple battery monitor ideal for openbox etc

Greetings...

First and foremost, this project is EXACTLY what I am looking for. Thank you.

That being said, I am Gentoo user, and am running into a few snags. I installed by unpacking the tarball and "manually" processing the steps in the PKGBUILD file.

If I run batterymon as root, the program starts with the following message in the console:

ERROR:dbus.proxies:Introspect error on :1.0:/org/freedesktop/Hal/Manager: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 1 matched rules; type="method_call", sender=":1.72" (uid=0 pid=8723 comm="python ./batterymon.py ") interface="org.freedesktop.DBus.Introspectable" member="Introspect" error name="(unset)" requested_reply=0 destination=":1.0" (uid=0 pid=3281 comm="/usr/sbin/hald --use-syslog --verbose=no "))
ERROR:dbus.proxies:Introspect error on :1.0:/org/freedesktop/Hal/Manager: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 1 matched rules; type="method_call", sender=":1.72" (uid=0 pid=8723 comm="python ./batterymon.py ") interface="org.freedesktop.DBus.Introspectable" member="Introspect" error name="(unset)" requested_reply=0 destination=":1.0" (uid=0 pid=3281 comm="/usr/sbin/hald --use-syslog --verbose=no "))
ERROR:dbus.proxies:Introspect error on :1.0:/org/freedesktop/Hal/devices/computer_power_supply_battery_BAT0: dbus.exceptions.DBusException: Rejected send message, 1 matched rules; type="method_call", sender=":1.72" (uid=0 pid=8723 comm="python ./batterymon.py ") interface="org.freedesktop.DBus.Introspectable" member="Introspect" error name="(unset)" requested_reply=0 destination=":1.0" (uid=0 pid=3281 comm="/usr/sbin/hald --use-syslog --verbose=no "))
ERROR:dbus.proxies:Introspect error on :1.0:/org/freedesktop/Hal/devices/computer_power_supply_ac_adapter_AC0: dbus.exceptions.DBusException: Rejected send message, 1 matched rules; type="method_call", sender=":1.72" (uid=0 pid=8723 comm="python ./batterymon.py ") interface="org.freedesktop.DBus.Introspectable" member="Introspect" error name="(unset)" requested_reply=0 destination=":1.0" (uid=0 pid=3281 comm="/usr/sbin/hald --use-syslog --verbose=no "))

However, when I run batterymon as a normal user, the program fails to start and I am given the following:

ERROR:dbus.proxies:Introspect error on :1.0:/org/freedesktop/Hal/Manager: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 1 matched rules; type="method_call", sender=":1.73" (uid=1000 pid=8744 comm="python ./batterymon.py ") interface="org.freedesktop.DBus.Introspectable" member="Introspect" error name="(unset)" requested_reply=0 destination=":1.0" (uid=0 pid=3281 comm="/usr/sbin/hald --use-syslog --verbose=no "))
Traceback (most recent call last):
  File "./batterymon.py", line 518, in <module>
    pm = PowerManager()
  File "./batterymon.py", line 423, in __init__
    self.adapter = AcAdapter()
  File "./batterymon.py", line 49, in __init__
    udis = self.hal.FindDeviceByCapability('ac_adapter')
  File "/usr/lib/python2.6/site-packages/dbus/proxies.py", line 68, in __call__
    return self._proxy_method(*args, **keywords)
  File "/usr/lib/python2.6/site-packages/dbus/proxies.py", line 140, in __call__
    **keywords)
  File "/usr/lib/python2.6/site-packages/dbus/connection.py", line 622, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 1 matched rules; type="method_call", sender=":1.73" (uid=1000 pid=8744 comm="python ./batterymon.py ") interface="org.freedesktop.Hal.Manager" member="FindDeviceByCapability" error name="(unset)" requested_reply=0 destination=":1.0" (uid=0 pid=3281 comm="/usr/sbin/hald --use-syslog --verbose=no "))

I'm pretty sure this has something to do with d-bus' default-deny policy, but I'm not exactly sure how to go about fixing it. Any help? My dream is to load batterymon from .xinitrc!

This is occurring with:

batterymon 1.2.0
dbus 1.2.12
hal 0.5.12-rc1-r6
python 2.6.2-r1
dbus-python 0.83.0-r1
pygtk 2.14.1

Finally...

Lars Stokholm wrote:

...
Edit 2: I also suggest changing "You do not seem to have libnotify installed. Notifications won't work." to "You do not seem to have notify-python installed. Notifications won't work.". In Arch notify-python is called python-notify, but notify-python will be more generic I think, as it is it's correct name.

I second that. I HAD libnotify installed, but did not have notify-python. After recompiling libnotify, and scratching my head, I read this thread and found the answer.

Anywho - Thanks again!

Last edited by gabe_ (2009-07-17 20:51:04)

Offline

#150 2009-07-21 22:17:26

genisis300
Member
From: Uk
Registered: 2008-01-15
Posts: 284

Re: Batterymon -- a simple battery monitor ideal for openbox etc

wow what an error message.

do you get the same error message if you run as a normal user.

I plan to restart work on this project asap, been a little busy recently

Thanks
Matthew


"is adult entertainment killing our children or is killing our children entertaining adults?" Marilyn Manson

Offline

Board footer

Powered by FluxBB