1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
/* ************************************************************************************ */
/* */
/* File : f_percent.asm /_________/ */
/* Author : Joe | */
/* Date : 04/2020 | */
/* Info : Gets batt remaining capacity | */
/* / | */
/* \ / */
/* \_____/ */
/* */
/* ************************************************************************************ */
section .text
extern system
extern atoi
global jo_f_percent
jo_f_percent:
mov rdi, f_cmd
call system
mov rdi, pr_file
mov rsi, 0x0
mov rax, 0x5
syscall
jc err
mov rdi, rax
mov rsi, buff
mov rdx, 0x3
mov rax, 0x3
syscall
jc err
mov rax, 0x6
syscall
xor rax, rax
mov rdi, rsi
call atoi
retq
err:
mov rax, 0xfe
retq
section .data
f_cmd: db "apm -l > /tmp/lowbat.percent", 0x0
pr_file: db "/tmp/lowbat.percent", 0x0
buff: db 0x0, 0x0, 0x0, 0x0
|