diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-16 18:44:48 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-16 18:44:48 +0200 |
commit | 7e831a1495736e3997502de43962d617b7218179 (patch) | |
tree | b61da68e5e24f54523fecf68be0cce789a3c2a8c /asm | |
parent | Create LICENSE (diff) | |
download | lowbat-bsd-7e831a1495736e3997502de43962d617b7218179.tar.gz lowbat-bsd-7e831a1495736e3997502de43962d617b7218179.tar.bz2 lowbat-bsd-7e831a1495736e3997502de43962d617b7218179.tar.xz lowbat-bsd-7e831a1495736e3997502de43962d617b7218179.tar.zst lowbat-bsd-7e831a1495736e3997502de43962d617b7218179.zip |
Read function is good
Diffstat (limited to 'asm')
-rw-r--r-- | asm/jo_f_status.asm | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/asm/jo_f_status.asm b/asm/jo_f_status.asm new file mode 100644 index 0000000..cc1deb2 --- /dev/null +++ b/asm/jo_f_status.asm @@ -0,0 +1,57 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; File : jo_f_status.asm /_________/ ;; +;; Author : Joe | ;; +;; Date : 04/2020 | ;; +;; Info : gets batt status | ;; +;; / | ;; +;; \ / ;; +;; \_____/ ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +section .text + extern system + extern malloc + extern printf + global jo_f_status + +jo_f_status: + mov rdi, f_cmd + call system + mov rdi, st_file + mov rsi, 0x0 + mov rax, 0x5 + syscall + jc err + push rax + mov rdi, 0x5 + call malloc + cmp rax, 0x0 + je err + mov rsi, rax + pop rax + mov rdi, rax + mov rdx, 0x4 + push rax + mov rax, 0x3 + syscall + jc err + pop rax + mov rdi, rax + mov rax, 0x6 + syscall + mov byte [rsi + 0x4], 0x0 + mov rax, rsi + retq + +err: + mov rax, 0x0 + retq + +section .data + f_cmd: db "apm | grep Status | awk -F ' ' '{print $3}' > /tmp/lowbat.status", 0x0 + st_file: db "/tmp/lowbat.status", 0x0 + + ;; charging + ;; discharg |