GithubHelp home page GithubHelp logo

tp-battery-icon's Introduction

tp-battery-icon's People

Contributors

michaelkrisper avatar phragment avatar schuschu avatar yunake avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tp-battery-icon's Issues

acpi_call number handling exception on newer kernels

On newer kernels the battery charging thresholds don't work producing an exception. I am not sure when this started, but I think it was with 3.10. I have tested 3.10.7 & 3.10.10. I am using ArchLinux with acpi_call-git from AUR, with the AUR patch disabled since it was already included upstream.

The exception occurs upon right-clicking the tray icon, since it tries to determine current thresholds and fails. Here's the exception text:

$ tp-battery-icon 
Traceback (most recent call last):
  File "./tp-battery-icon.py", line 369, in on_popup_menu
    self.get_menu()
  File "./tp-battery-icon.py", line 318, in get_menu
    start = Gtk.MenuItem("Start Threshold " + str(ctrl.get_start_threshold()) + "%")
  File "./tp-battery-icon.py", line 158, in get_start_threshold
    return int(result, 16) - (3 * 256)
ValueError: null byte in argument for int()

This happens because /proc/acpi/call returns some weird result:

$ echo "\_SB.PCI0.LPC.EC.HKEY.BCSG 0x1" | sudo tee /proc/acpi/call
$ hexdump -C /proc/acpi/call                                                                                                                
00000000  30 78 33 33 32 00 6c 6c  65 64 00                 |0x332.lled.|
0000000b

So the returning value is essentially two null-terminated strings. The good news is that the first string still contains the proper threshold value, and writing to /proc/acpi/call still changes it correctly.

I will send a patch shortly that strips out the first string from acpi_call. There should be no regression on older kernels. Let me know if this is an acceptable approach or you want to understand why this happens (I have not seen any appropriate description of this change in behaviour upstream). I also have no idea what happens on systems supported by ControlTPsmapi. Some kind of testing of these systems as well as systems with older kernels would be good.

gtk bindings problem

Apparently there has been some change in your python gtk3 bindings since since

loop = GObject.MainLoop(None,False)

no longer requires/takes the second argument. Removing it seems fine...

Traceback (most recent call last):
  File "/usr/bin/tp-battery-icon", line 547, in <module>
    loop = GObject.MainLoop(None,False)
  File "/usr/lib/python3.3/site-packages/gi/overrides/__init__.py", line 86, in wrapped
    return fn(*args, **kwargs)
TypeError: __new__() takes from 1 to 2 positional arguments but 3 were given

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.