Skip to content

Commit

Permalink
Fix Bug in battery.module
Browse files Browse the repository at this point in the history
Detect BAT0 & BAT1
  • Loading branch information
eloaders committed Jan 31, 2012
1 parent 02bc685 commit 5c1d8ac
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 16 deletions.
Binary file modified src/i-nex/.gambas/BATTERY
Binary file not shown.
Binary file modified src/i-nex/.gambas/FINFOSYS
Binary file not shown.
Binary file modified src/i-nex/.gambas/USB_DRIVES
Binary file not shown.
6 changes: 3 additions & 3 deletions src/i-nex/.settings
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ SearchComment=False
SearchString=True

[OpenFile]
Active=1
File[1]=".src/Finfosys.form"
File[2]=".src/Finfosys.class:552.19"
File[2]=".src/Finfosys.class:550.41"
File[3]=".src/Global.class:120.69"
File[4]=".src/About.form"
File[5]=".src/About.class:29.47"
Expand All @@ -34,7 +33,8 @@ File[15]=".src/ScreenShotM.module:2.21"
File[16]=".src/DmidecodeM.module:8.37"
File[17]=".src/GetPassword.form"
File[18]=".src/GetPassword.class:15.3"
File[19]=".src/USB_Drives.module:56.89"
Active=19
File[19]=".src/USB_Drives.module:13.38"
Count=19

[Watches]
Expand Down
4 changes: 3 additions & 1 deletion src/i-nex/.src/Finfosys.class
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
Public Sub Form_Open()
Dim default_display_manager As Boolean = Exist("/etc/X11/default-display-manager")
Dim cpuz0, cpuz1, cpuz2, cpuz3, cpuz4, cpuz5, cpuz6, cpuz7, cpuz8, cpuz9, cpuz10, cpuz11 As String
Finfosys.TabStrip1[9].Visible = False
Object.Call(battery, "_init")
Debug "Check for Usb device plugged"
Object.Call(USB_Drives, "_init")
Debug "Check for Drives"
Expand All @@ -20,7 +22,6 @@ Public Sub Form_Open()
TextBox22.Text = Replace(TextBox22.Text, "\n", "")
Debug "Default display manager is " & TextBox22.Text
Endif
Object.Call(battery, "_init")
TextLabel21.Visible = False
'Procesor
Debug "Check available procesors"
Expand Down Expand Up @@ -549,6 +550,7 @@ Public Sub refreshing()
' Endif
' If checking_device_uuid Like "" & Disk_Drives.device_uuid & "" Then
' TextArea8.Text = checking_device_uuid
'
' Endif
End

Expand Down
4 changes: 2 additions & 2 deletions src/i-nex/.src/USB_Drives.module
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Dim righe As New String[]
Dim riga As New String[]
Dim lista As New String[]
Debug "Add Drives to ComboBox.."
Shell "ls /sys/bus/usb/devices/*/* | grep 'product' | grep [0-9] | cut -d '/' -f 6" To ListAllDiscs
Shell "ls /sys/bus/usb/devices/*/* | grep 'product' | grep [0-9] | cut -d '/' -f 6" To ListAllDiscs
righe = Split(ListAllDiscs, "\n", "%%", True)
For count = 0 To righe.Max
riga = Split(righe[count], " ", "%%", True)
Expand Down Expand Up @@ -60,4 +60,4 @@ Public Sub export_informations()
Finfosys.TextBox51.Text = idVendor
Finfosys.TextBox43.Text = lsusb

End
End
37 changes: 27 additions & 10 deletions src/i-nex/.src/battery.module
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
' Gambas module file

Public battery_exist As Boolean = Exist("/proc/acpi/battery/BAT1/info")
Public addres_battery As String = "/proc/acpi/battery/BAT1/info"
Public addres_battery As String
Public Present As String
Public Design_capacity As String
Public last_full_capacity As String
Expand All @@ -19,14 +18,19 @@ Public OEM_info As String


Public Sub _init()
If battery_exist = True Then
Debug "Battery found " & addres_battery & ""
_get_inf()
_replace_n()
Object.Call(Finfosys, "battery_info")
Else
Finfosys.TabStrip1[9].Visible = False
Debug "Battery not found in " & addres_battery & ""
If Exist("/proc/acpi/battery/BAT0", True) Then
addres_battery = "/proc/acpi/battery/BAT0/info"
Finfosys.TabStrip1[9].Visible = True
battery._get_inf()
battery._replace_n()
Finfosys.battery_info()
Endif
If Exist("/proc/acpi/battery/BAT1/info", True) Then
addres_battery = "/proc/acpi/battery/BAT1/info"
Finfosys.TabStrip1[9].Visible = True
battery._get_inf()
battery._replace_n()
Finfosys.battery_info()
Endif
End

Expand All @@ -51,18 +55,31 @@ End

Public Sub _replace_n()
Present = Replace(Present, "\n", "")
Present = Replace(Present, " ", "")
Design_capacity = Replace(Design_capacity, "\n", "")
Design_capacity = Replace(Design_capacity, " ", "")
last_full_capacity = Replace(last_full_capacity, "\n", "")
last_full_capacity = Replace(last_full_capacity, " ", "")
battery_technology = Replace(battery_technology, "\n", "")
battery_technology = Replace(battery_technology, " ", "")
design_voltage = Replace(design_voltage, "\n", "")
design_voltage = Replace(design_voltage, " ", "")
design_capacity_warning = Replace(design_capacity_warning, "\n", "")
design_capacity_warning = Replace(design_capacity_warning, " ", "")
design_capacity_low = Replace(design_capacity_low, "\n", "")
design_capacity_low = Replace(design_capacity_low, " ", "")
cycle_count = Replace(cycle_count, "\n", "")
cycle_count = Replace(cycle_count, " ", "")
capacity_granularity_1 = Replace(capacity_granularity_1, "\n", "")
capacity_granularity_1 = Replace(capacity_granularity_1, " ", "")
capacity_granularity_2 = Replace(capacity_granularity_2, "\n", "")
capacity_granularity_2 = Replace(capacity_granularity_2, " ", "")
model_number = Replace(model_number, "\n", "")
model_number = Replace(model_number, " ", "")
serial_number = Replace(serial_number, "\n", "")
serial_number = Replace(serial_number, " ", "")
battery_type = Replace(battery_type, "\n", "")
battery_type = Replace(battery_type, " ", "")
OEM_info = Replace(OEM_info, "\n", "")
End

0 comments on commit 5c1d8ac

Please sign in to comment.