Code Monkey home page Code Monkey logo

linux-fake-battery-module's Introduction

Fake Battery Module for the Linux kernel

This is a kernel module I wrote (based mainly on the test_power module included in the Linux kernel source) for simulating multiple batteries on Linux.

This is my first module, so don't hold me responsible if you use it and it causes a kernel panic. =)

This is something I wrote a while ago and am not actively maintaining, so don't be surprised if it doesn't compile against newer kernels or otherwise does not work!

Loading the module

You can build the module with a simple make, and load it with insmod:

$ sudo insmod ./fake_battery.ko

Changing battery values via /dev/fake_battery

You can write values to /dev/fake_battery to change the current charging/discharging and charge levels of the battery:

$ echo 'charging = 0' | sudo tee /dev/fake_battery # set state to discharging
$ echo 'charging = 1' | sudo tee /dev/fake_battery # set state to charging
$ echo 'capacity0 = 77' | sudo tee /dev/fake_battery # set charge on BAT0 to 77%
$ echo 'capacity1 = 77' | sudo tee /dev/fake_battery # set charge on BAT1 to 77%

linux-fake-battery-module's People

Contributors

hoelzro avatar skinner927 avatar

Watchers

 avatar

Forkers

ringof

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.