I-Nex/I-Nex/i-nex/.src/MAIN/Finfosys.class

1107 lines
37 KiB
Plaintext

' Gambas class file
' Copyright(C) 2011-2014, Michał Głowienka aka eloaders <eloaders@linux.pl>
'
' This program is free software; you can redistribute it and/or modify
' it under the terms of the GNU General Public License as published by
' the Free Software Foundation; either version 3 of the License, or
' (at your option) any later version.
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' GNU General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program. If not, see <http://www.gnu.org/licenses/>.
Public INEXGLINFO As Process
Public AllowLog As Boolean
Public cpu As String
Public CPU_FLAGS As New String[]
Public CPU_VENDOR_ID As New String[]
Public CPU_PROCESSOR As New String[]
Public CPU_CPU_CORES As New String[]
Public Logs As New Logger
Public GDF As String
Public UNAME As Collection
Public USAGE As Collection
Public INDEX0 As String
Public INDEX1 As String
Public INDEX2 As String
Public INDEX3 As String
Public MEMINFO_FILE As File
Public Sub Form_Open()
Dim data As Stream
Dim MaxCount As Integer
Dim sLine As String
Dim MTRR As New String[]
Label74.Text = "I-Nex " & Application.Version
Logs("Starting log", Logger.Info)
ComboBox10.Visible = False
''Okno na środku
''
If Settings["Window/X"] = Null Then
Me.Center
Else
Try Me.X = Settings["Window/X", Me.X]
Try Me.Y = Settings["Window/Y", Me.Y]
'Try to set Orientation of Tabstrip
Try TabStrip1.Orientation = Settings["Tab/Pos", TabStrip1.Orientation]
'If orientation detected then this set size of main window
Select Case TabStrip1.Orientation
Case 1
Logs("TabStrip1.Orientation Left", Logger.Info)
Orientation_Left_Click()
Case 2
Logs("TabStrip1.Orientation Right", Logger.Info)
Orientation_Right_Click()
Case 19
Logs("TabStrip1.Orientation Top", Logger.Info)
Orientation_Top_Click()
Case 35
Logs("TabStrip1.Orientation Bottom", Logger.Info)
Orientation_Bottom_Click()
End Select
Endif
Logs("Call to MLibcpuid14", Logger.Info)
Object.Call(MLibcpuid14, "main")
Try data = Open "/proc/mtrr" For Input
While Not Eof(data)
Line Input #data, sLine
MaxCount += 1
MTRR.Add(sLine, MaxCount)
Wend
Try Close #data
' If Exist("/proc/mtrr", True) Then
' For i = 1 To MaxCount
' Label[i] = New Label(ScrollView2)
' With Label[i]
' .X = 2
' .Y = Int(i * 20)
' .Width = 440
' .Height = 21
' .Border = Border.Raised
' .Padding = 3
' .Font.Size = 8
' .Text = MTRR[i - 1]
' End With
' Next
' Endif
'Procesor
Logs("Check available procesors", Logger.Info)
ComboBox1.List = Dir("/sys/devices/system/cpu/", "cpu[0-9]")
'Locate kernels
MaxCount = 0
' Try data = Shell "ls /boot | grep 'vmlinuz*'" For Input
'
' While Not Eof(data)
' Line Input #data, sLine
' MaxCount += 1
' ListBox1.Add(sLine, MaxCount)
' Wend
'
' Try Close #data
ListBox1.List = Dir("/boot/", "vmlinuz*")
Label228.Text = "Installed Kernels: " & CString(Dir("/boot/", "vmlinuz*").Count)
'End of locate kernels
If User.Name = "root" Then
Message.Error(("Running as root is not allowed!\n " & User.Home & ""))
Endif
Logs(Settings.Path, Logger.Info)
Logs(Settings.DefaultDir, Logger.Info)
Finfosys.TabStrip1[9].Visible = False
Finfosys.TabStrip1[11].Visible = False
Logs("Call to MInit for copy nedded files to I-Nex config dir in User.Home", Logger.Info)
Object.Call(MInit, "_inits")
Logs("Settings default dir = " & Settings.DefaultDir & "", Logger.Info)
Logs("Check for Battery", Logger.Info)
Object.Call(battery, "_inits")
Logs("Check for Usb device plugged", Logger.Info)
Object.Call(USB_Drives, "_inits")
Logs("Check for Drives", Logger.Info)
Object.Call(Disk_Drives, "_inits")
Logs("Check for Drives..", Logger.Info)
Object.Call(Disk_Drives, "_init_2")
Logs("Check for Drives....", Logger.Info)
Object.Call(Disk_Drives, "get_informations")
Logs("Check for Input Drives", Logger.Info)
Object.Call(Input_Devices, "_inits")
Logs("Check available network devices", Logger.Info)
Object.Call(Network, "inits")
Logs("Check available graphic DSub, DVI etc", Logger.Info)
Object.Call(FGraphic, "_inits")
Logs("Call to Graphic", Logger.Info)
Object.Call(FGraphic, "_check")
Logs("Check sound cards", Logger.Info)
Object.Call(Asound_Drives, "_inits")
'Check temperature. If temterature is OK then timer start 1500/ms. Check temp 1500/ms
Timer1.Start
Timer1.Delay = 1500
TextLabel21.Visible = False
Logs("Set Combobox to cpu0", Logger.Info)
ComboBox1.Index = 0 ''Ustawienie combobox na Procesor0 / W przeciwnym wypadku nie pokaże nic
'Uruchomienie instrukcji dla poszczególnych zakładek w celu wydobycia informacji z systemu
Logs("Check Dospam uptime", Logger.Info)
dospam_uptime()
Logs("Check System", Logger.Info)
Object.Call(MSystem, "System")
Logs("Call to Distribution_Detect", Logger.Info)
Object.Call(Distribution_Detect, "_inits")
Logs("Check Bios", Logger.Info)
Object.Call(MMobo, "bios")
Logs("Check Kernels", Logger.Info)
Object.Call(MKernel, "kernel")
Logs("Check graphic card", Logger.Info)
grafika()
''END Uruchomienie instrukcji dla poszczególnych zakładek w celu wydobycia informacji z systemu
Label25.Text = Application.version
Logs(Label25.Text, Logger.Info)
TabStrip1_Click()
End
Public Sub ComboBox1_Click()
Logs("Checking procesors", Logger.Info)
Wykrywanie_procesorow()
End
Public Sub grafika()
Dim available_resolutions, Kernel_driver_in_use As String
Dim rozdzielczosc, gpu, memory_prefetchable, memory_non_prefetchable As String
Dim GLIXNFO As String
Dim GLX As String[]
Dim strings As String
Try Exec ["/bin/bash", User.Home &/ ".i-nex/i-nex-lspci", "nonprefetchable"] Wait To memory_non_prefetchable
Try Exec ["/bin/bash", User.Home &/ ".i-nex/i-nex-lspci", "prefetchable"] Wait To memory_prefetchable
Try Exec ["glxinfo"] Wait To GLIXNFO
GLX = Split(GLIXNFO, "\n", "")
For Each strings In GLX
If strings Like "*OpenGL vendor string:*" Then
Try Label105.Text = "OpenGL Vendor: " & Replace(strings, "OpenGL vendor string:", "")
Endif
If strings Like "*OpenGL renderer string:*" Then
Try Label106.Text = "OpenGL Renderer: " & Replace(strings, "OpenGL renderer string:", "")
Endif
If strings Like "*OpenGL version string:*" Then
Try Label107.Text = "OpenGL Version: " & Replace(strings, "OpenGL version string:", "")
Endif
If strings Like "*server glx vendor string:*" Then
Try Label220.Text = "Server glx vendor: " & Replace(strings, "server glx vendor string:", "")
Endif
If strings Like "*server glx version string:*" Then
Try Label221.Text = "Server glx version: " & Replace(strings, "server glx version string:", "")
Endif
If strings Like "*client glx vendor string:*" Then
Try Label222.Text = "Client glx vendor: " & Replace(strings, "client glx vendor string:", "")
Endif
If strings Like "*client glx version string:*" Then
Try Label224.Text = "Client glx version: " & Replace(strings, "client glx version string:", "")
Endif
If strings Like "*GLX version:*" Then
Try Label225.Text = "GLX version: " & Replace(strings, "GLX version:", "")
Endif
If strings Like "*OpenGL ES profile version string:*" Then
Try Label246.Text = "OpenGLES PVS: " & Replace(strings, "OpenGL ES profile version string:", "")
Endif
If strings Like "*OpenGL ES profile shading language version string:*" Then
Try Label247.Text = "OpenGLES PSLVS: " & Replace(strings, "OpenGL ES profile shading language version string:", "")
Endif
Next
Shell ChkPrm.ChkExecDir("lspci") & " -v -s `lspci | awk '/VGA/{print $1}'` | grep \"Kernel driver in use:\" | cut -d ':' -f 2" Wait To Kernel_driver_in_use
Shell ChkPrm.ChkExecDir("lspci") & " | grep 'VGA' | cut -d ':' -f3 | cut -d '(' -f 1 | sed -n '1p'" Wait To gpu
Shell ChkPrm.ChkExecDir("xrandr") & " | grep current | grep 'Screen 0:' | cut -d ':' -f 2" Wait To available_resolutions
Shell ChkPrm.ChkExecDir("xdpyinfo") & " | grep 'dimensions:' | cut -d ':' -f 2" Wait To rozdzielczosc
If IsNull(Kernel_driver_in_use) Or IsSpace(Kernel_driver_in_use) = True Then
Try Exec [ChkPrm.ChkExecDir("xdriinfo")] Wait To Kernel_driver_in_use
Endif
Label136.Text = "Kernel driver in use: " & Replace(Kernel_driver_in_use, "\n", "")
Try Label64.Text = "Total Memory prefetchable: " & Replace(memory_prefetchable, "\n", " - ")
Try Label146.Text = "Total Memory non-prefetchable: " & Replace(memory_non_prefetchable, "\n", " - ")
Label108.Text = "Present resolution: " & Replace(rozdzielczosc, "\n", "")
TextBox1.Text = RTrim(Replace(gpu, "\n", ""))
Label109.Text = Replace(available_resolutions, "\n", "")
'GPU Logo Detection
If RTrim(Replace(gpu, "\n", "")) Like "*ati*" Then
Finfosys.PictureBox1.Picture = Picture["Data/GPU_LOGO/ati.png"]
Finfosys.PictureBox1.Name = "ati.png"
Endif
If RTrim(Replace(gpu, "\n", "")) Like "*intel*" Then
Finfosys.PictureBox1.Picture = Picture["Data/GPU_LOGO/intel.png"]
Finfosys.PictureBox1.Name = "intel.png"
Endif
If RTrim(Replace(gpu, "\n", "")) Like "*nVidia*" Then
Finfosys.PictureBox1.Picture = Picture["Data/GPU_LOGO/nvidia.png"]
Finfosys.PictureBox1.Name = "nvidia.png"
Endif
If RTrim(Replace(gpu, "\n", "")) Like "*VirtualBox*" Then
Finfosys.PictureBox1.Picture = Picture["Data/GPU_LOGO/virtualbox.png"]
Finfosys.PictureBox1.Name = "virtualbox.png"
Endif
If RTrim(Replace(gpu, "\n", "")) Like "*VMware*" Then
Finfosys.PictureBox1.Picture = Picture["Data/GPU_LOGO/vmware.png"]
Finfosys.PictureBox1.Name = "vmware.png"
Endif
'GPU Logo Detection End
ComboBox8.Index = 1
End
Public Sub Wykrywanie_procesorow()
Dim L0TYPE, L1TYPE, L2TYPE, L3TYPE As String
Dim L0LEVEL, L1LEVEL, L2LEVEL, L3LEVEL As String
Dim L0WAYS, L1WAYS, L2WAYS, L3WAYS As String
Dim COHERENCY0, COHERENCY1, COHERENCY2, COHERENCY3 As String
Dim NUMOFSETS0, NUMOFSETS1, NUMOFSETS2, NUMOFSETS3 As String
Dim CPUINFO_PROC As File
Dim sIcon As String
Dim sLine As String
Dim iPos As Integer
Dim Character As Integer
Dim sKey As String
Dim sVal As String
Dim CPU_FAMILYz As New String[]
Dim CPU_MODEL As New String[]
Dim CPU_MODEL_NAME As New String[]
Dim CPU_STEPPING As New String[]
Dim CPU_MICROCODE As New String[]
Dim CPU_CPU_MHZ As New String[]
Dim CPU_CACHE_SIZE As New String[]
Dim CPU_PHYSICAL_ID As New String[]
Dim CPU_SIBLINGS As New String[]
Dim CPU_CORE_ID As New String[]
Dim CPU_APICID As New String[]
Dim CPU_INITIAL_APICID As New String[]
Dim CPU_FPU As New String[]
Dim CPU_FPU_EXCEPTION As New String[]
Dim CPU_CPUID_LEVEL As New String[]
Dim CPU_WP As New String[]
Dim CPU_BOGOMIPS As New String[]
Dim CPU_CLFLUSH_SIZE As New String[]
Dim CPU_CACHE_ALIGNMENT As New String[]
Dim CPU_ADRESS_SIZES As New String[]
Dim CPU_POWER_MANAGEMENT As New String[]
If IsNull(MStart.CPUINFO_FILE) = True Then
CPUINFO_PROC = Open "/proc/cpuinfo"
Else
CPUINFO_PROC = Open MStart.CPUINFO_FILE
Endif
For Each sLine In CPUINFO_PROC.Lines
sLine = Trim(sLine)
If Not sLine Then Continue
iPos = InStr(sLine, ":")
If iPos = 0 Then Continue
sKey = Trim(Left$(sLine, iPos - 1))
sVal = Trim(Mid$(sLine, iPos + 1))
Select Case sKey
Case "processor"
CPU_PROCESSOR.Add(sVal)
Case "vendor_id"
CPU_VENDOR_ID.Add(sVal)
Case "cpu family"
CPU_FAMILYz.Add(sVal)
Case "model"
CPU_MODEL.Add(sVal)
Case Like "[Mm]odel name"
Character = InStr(sVal, "@")
CPU_MODEL_NAME.Add(Trim(Left$(sVal, Character - 1)))
Case "stepping"
CPU_STEPPING.Add(sVal)
Case "microcode"
CPU_MICROCODE.Add(sVal)
Case "cpu MHz"
CPU_CPU_MHZ.Add(sVal)
Case "cache size"
CPU_CACHE_SIZE.Add(sVal)
Case "physical id"
CPU_PHYSICAL_ID.Add(sVal)
Case "siblings"
CPU_SIBLINGS.Add(sVal)
Case "core id"
CPU_CORE_ID.Add(sVal)
Case "cpu cores"
CPU_CPU_CORES.Add(sVal)
Case "apicid"
CPU_APICID.Add(sVal)
Case "initial apicid"
CPU_INITIAL_APICID.Add(sVal)
Case "fpu"
CPU_FPU.Add(sVal)
Case "fpu_exception"
CPU_FPU_EXCEPTION.Add(sVal)
Case "cpuid level"
CPU_CPUID_LEVEL.Add(sVal)
Case "wp"
CPU_WP.Add(sVal)
Case "flags"
CPU_FLAGS.Add(sVal)
Case "bogomips"
CPU_BOGOMIPS.Add(sVal)
Case "clflush size"
CPU_CLFLUSH_SIZE.Add(sVal)
Case "cache_alignment"
CPU_CACHE_ALIGNMENT.Add(sVal)
Case "address sizes"
CPU_ADRESS_SIZES.Add(sVal)
Case "power management"
CPU_POWER_MANAGEMENT.Add(sVal)
End Select
Next
Close #CPUINFO_PROC
Try TextBox32.Text = Replace(CPU_MODEL_NAME[CFloat(ComboBox1.Index)], "\n", "")
Try TextBox32.Tooltip = Replace(CPU_MODEL_NAME[CFloat(ComboBox1.Index)], "\n", "")
Try TextBox36.Text = "Flags: " & FFlags.instructions
Try Label13.Text = UCase$(Replace(Replace(Replace(CPU_VENDOR_ID[CFloat(ComboBox1.Index)], "Authentic", ""), "Genuine", ""), "\n", ""))
Try TextBox33.Text = Replace(CPU_CPU_MHZ[CFloat(ComboBox1.Index)], "\n", "") & " MHz"
Try TextBox34.Text &= "Family: " & Replace(CPU_FAMILYz[CFloat(ComboBox1.Index)], "\n", "")
Try TextBox34.Text &= " | Model: " & Replace(CPU_MODEL[CFloat(ComboBox1.Index)], "\n", "")
Try TextBox34.Text &= " | Stepping: " & Replace(CPU_STEPPING[CFloat(ComboBox1.Index)], "\n", "")
Try TextBox34.Text &= " | Cores: " & Replace(CPU_SIBLINGS[CFloat(ComboBox1.Index)], "\n", "")
Try TextBox34.Text &= " | Phy id: " & Replace(CPU_PHYSICAL_ID[CFloat(ComboBox1.Index)], "\n", "")
Try Label10.Text = "Bogomips: " & Replace(CPU_BOGOMIPS[CFloat(ComboBox1.Index)], "\n", "")
Try TextBox35.Text = "Address sizes: " & Replace(CPU_ADRESS_SIZES[CFloat(ComboBox1.Index)], "\n", "")
Try Label15.Text = "Power mangament: " & Replace(CPU_POWER_MANAGEMENT[CFloat(ComboBox1.Index)], "\n", "")
Try INDEX0 = Replace(File.Load("/sys/devices/system/cpu/" & Subst(ComboBox1.Current.Text) & "/cache/index0/size"), "\n", "")
Try INDEX1 = Replace(File.Load("/sys/devices/system/cpu/" & Subst(ComboBox1.Current.Text) & "/cache/index1/size"), "\n", "")
Try INDEX2 = Replace(File.Load("/sys/devices/system/cpu/" & Subst(ComboBox1.Current.Text) & "/cache/index2/size"), "\n", "")
Try INDEX3 = Replace(File.Load("/sys/devices/system/cpu/" & Subst(ComboBox1.Current.Text) & "/cache/index3/size"), "\n", "")
Try L0TYPE = Replace(File.Load("/sys/devices/system/cpu/" & Subst(ComboBox1.Current.Text) & "/cache/index0/type"), "\n", "")
Try L1TYPE = Replace(File.Load("/sys/devices/system/cpu/" & Subst(ComboBox1.Current.Text) & "/cache/index1/type"), "\n", "")
Try L2TYPE = Replace(File.Load("/sys/devices/system/cpu/" & Subst(ComboBox1.Current.Text) & "/cache/index2/type"), "\n", "")
Try L3TYPE = Replace(File.Load("/sys/devices/system/cpu/" & Subst(ComboBox1.Current.Text) & "/cache/index3/type"), "\n", "")
Try L0LEVEL = Replace(File.Load("/sys/devices/system/cpu/" & Subst(ComboBox1.Current.Text) & "/cache/index0/level"), "\n", "")
Try L1LEVEL = Replace(File.Load("/sys/devices/system/cpu/" & Subst(ComboBox1.Current.Text) & "/cache/index1/level"), "\n", "")
Try L2LEVEL = Replace(File.Load("/sys/devices/system/cpu/" & Subst(ComboBox1.Current.Text) & "/cache/index2/level"), "\n", "")
Try L3LEVEL = Replace(File.Load("/sys/devices/system/cpu/" & Subst(ComboBox1.Current.Text) & "/cache/index3/level"), "\n", "")
Try L0WAYS = Replace(File.Load("/sys/devices/system/cpu/" & Subst(ComboBox1.Current.Text) & "/cache/index0/ways_of_associativity"), "\n", "")
Try L1WAYS = Replace(File.Load("/sys/devices/system/cpu/" & Subst(ComboBox1.Current.Text) & "/cache/index1/ways_of_associativity"), "\n", "")
Try L2WAYS = Replace(File.Load("/sys/devices/system/cpu/" & Subst(ComboBox1.Current.Text) & "/cache/index2/ways_of_associativity"), "\n", "")
Try L3WAYS = Replace(File.Load("/sys/devices/system/cpu/" & Subst(ComboBox1.Current.Text) & "/cache/index3/ways_of_associativity"), "\n", "")
Try COHERENCY0 = Replace(File.Load("/sys/devices/system/cpu/" & Subst(ComboBox1.Current.Text) & "/cache/index0/coherency_line_size"), "\n", "")
Try COHERENCY1 = Replace(File.Load("/sys/devices/system/cpu/" & Subst(ComboBox1.Current.Text) & "/cache/index1/coherency_line_size"), "\n", "")
Try COHERENCY2 = Replace(File.Load("/sys/devices/system/cpu/" & Subst(ComboBox1.Current.Text) & "/cache/index2/coherency_line_size"), "\n", "")
Try COHERENCY3 = Replace(File.Load("/sys/devices/system/cpu/" & Subst(ComboBox1.Current.Text) & "/cache/index3/coherency_line_size"), "\n", "")
Try NUMOFSETS0 = Replace(File.Load("/sys/devices/system/cpu/" & Subst(ComboBox1.Current.Text) & "/cache/index0/number_of_sets"), "\n", "")
Try NUMOFSETS1 = Replace(File.Load("/sys/devices/system/cpu/" & Subst(ComboBox1.Current.Text) & "/cache/index1/number_of_sets"), "\n", "")
Try NUMOFSETS2 = Replace(File.Load("/sys/devices/system/cpu/" & Subst(ComboBox1.Current.Text) & "/cache/index2/number_of_sets"), "\n", "")
Try NUMOFSETS3 = Replace(File.Load("/sys/devices/system/cpu/" & Subst(ComboBox1.Current.Text) & "/cache/index3/number_of_sets"), "\n", "")
Try Label1.Text = Subst("Cache L&1 &2 &3 WOA: &4 CLS: &5 NOS: &6",
L0LEVEL,
INDEX0,
L0TYPE,
L0WAYS,
COHERENCY0,
NUMOFSETS0)
Try Label1.Tooltip = Subst("Cache L&1 &2 &3 WOA: &4 CLS: &5 NOS: &6",
L0LEVEL,
INDEX0,
L0TYPE,
L0WAYS,
COHERENCY0,
NUMOFSETS0)
Try Label2.Text = Subst("Cache L&1 &2 &3 WOA: &4 CLS: &5 NOS: &6",
L1LEVEL,
INDEX1,
L1TYPE,
L1WAYS,
COHERENCY1,
NUMOFSETS1)
Try Label2.Tooltip = Subst("Cache L&1 &2 &3 WOA: &4 CLS: &5 NOS: &6",
L1LEVEL,
INDEX1,
L1TYPE,
L1WAYS,
COHERENCY1,
NUMOFSETS1)
Try Label3.Text = Subst("Cache L&1 &2 &3 WOA: &4 CLS: &5 NOS: &6",
L2LEVEL,
INDEX2,
L2TYPE,
L2WAYS,
COHERENCY2,
NUMOFSETS2)
Try Label3.Tooltip = Subst("Cache L&1 &2 &3 WOA: &4 CLS: &5 NOS: &6",
L2LEVEL,
INDEX2,
L2TYPE,
L2WAYS,
COHERENCY2,
NUMOFSETS2)
If IsNull(L3LEVEL) = False Then
Try Label5.Text = Subst("Cache L&1 &2 &3 WOA: &4 CLS: &5 NOS: &6",
L3LEVEL,
INDEX3,
L3TYPE,
L3WAYS,
COHERENCY3,
NUMOFSETS3)
Try Label5.Tooltip = Subst("Cache L&1 &2 &3 WOA: &4 CLS: &5 NOS: &6",
L3LEVEL,
INDEX3,
L3TYPE,
L3WAYS,
COHERENCY3,
NUMOFSETS3)
Else
Label5.Visible = False
Endif
Logs("Get info from database", Logger.Info)
Object.Call(FCpudb, "_inits")
End
Public Sub Refresh_CPU_MHZ()
Dim CPUINFO_PROC As File
Dim sLine As String
Dim iPos As Integer
Dim sKey As String
Dim sVal As String
Dim CPU_CPU_MHZ As New String[]
CPUINFO_PROC = Open "/proc/cpuinfo"
For Each sLine In CPUINFO_PROC.Lines
sLine = Trim(sLine)
If Not sLine Then Continue
iPos = InStr(sLine, ":")
If iPos = 0 Then Continue
sKey = Trim(Left$(sLine, iPos - 1))
sVal = Trim(Mid$(sLine, iPos + 1))
Select Case sKey
Case "cpu MHz"
CPU_CPU_MHZ.Add(sVal)
End Select
Next
Try TextBox33.text = CPU_CPU_MHZ[(Mid$(ComboBox1.Current.Text, 4))] & " MHz"
End
Public Sub Button2_Click()
ScreenShot.pic = Desktop.Screenshot(Me.X, Me.Y, Me.W + 12, Me.H + 30)
ScreenShot.Show
End
Public Sub dospam_uptime()
Dim sLine As String
Dim iPos As Integer
Dim sKey As String
Dim sVal As String
Dim MemTotal As Float
Dim MemFree As Float
Dim MemAvailable As Float
Dim Buffers As Float
Dim Cached As Float
Dim SwapCached As Float
Dim SwapTotal As Float
Dim SwapFree As Float
Dim Active As Float
Dim MEMINFO_FILE As File
If IsNull(MEMINFO_FILE) = True Then
MEMINFO_FILE = Open "/proc/meminfo"
' Else
' MEMINFO_FILE = Open MStart.MEMINFO_FILE
Endif
For Each sLine In MEMINFO_FILE.Lines
sLine = Trim(sLine)
If Not sLine Then Continue
iPos = InStr(sLine, ":")
If iPos = 0 Then Continue
sKey = Trim(Left$(sLine, iPos - 1))
sVal = Trim(Mid$(sLine, iPos + 1))
sVal = Replace(sVal, "kB", Null)
Select Case sKey
Case "MemTotal"
MemTotal = Val(sVal) / 1000
Case "MemFree"
MemFree = Val(sVal) / 1000
Case "MemAvailable"
MemAvailable = Val(sVal) / 1000
Case "Buffers"
Buffers = Val(sVal) / 1000
Case "Cached"
Cached = Val(sVal) / 1000
Case "SwapCached"
SwapCached = Val(sVal) / 1000
Case "SwapTotal"
SwapTotal = Val(sVal) / 1000
Case "SwapFree"
SwapFree = Val(sVal) / 1000
Case "Active"
Active = Val(sVal) / 1000
End Select
Next
Close #MEMINFO_FILE
'Solution
'https://access.redhat.com/solutions/406773
Label223.Text = "Mem used: " & CString(MemTotal - (MemFree + Buffers + Cached)) & " MB"
TextLabel24.Text = "Swap used: " & (SwapTotal - SwapFree) & " MB"
'Labels
Label85.Text = "Mem Total: " & MemTotal & "MB"
Label86.Text = "Mem Free: " & MemFree & "MB"
Label87.Text = "Mem Available: " & MemAvailable & "MB"
Label88.Text = "Buffers: " & Buffers & "MB"
Label89.Text = "Cached: " & Cached & "MB"
Label90.Text = "Swap Cached: " & SwapCached & "MB"
Label91.Text = "Swap Total: " & SwapTotal & "MB"
Label265.Text = "Swap Free: " & SwapFree & "MB"
Label266.Text = "Active: " & Active & "MB"
Try ProgressBar1.Value = (MemTotal - (MemFree + Buffers + Cached)) / MemTotal
Try ProgressBar4.Value = (SwapTotal - SwapFree) / SwapTotal
Try MUptime.Main()
End
Public Sub battery_info()
Logs("Get information Active Battery", Logger.Info)
TextBox7.Text = battery.Present
TextBox8.Text = battery.Design_capacity
TextBox9.Text = battery.last_full_capacity
TextBox10.Text = battery.battery_technology
TextBox11.Text = battery.design_voltage
TextBox12.Text = battery.design_capacity_warning
TextBox13.Text = battery.design_capacity_low
TextBox14.Text = battery.cycle_count
TextBox15.Text = battery.capacity_granularity_1
TextBox16.Text = battery.capacity_granularity_2
TextBox17.Text = battery.model_number
TextBox18.Text = battery.serial_number
TextBox19.Text = battery.battery_type
TextBox20.Text = battery.OEM_info
Logs("Get information Active Battery Done", Logger.Info)
If Exist("/sys/class/power_supply/BAT1/", True) Or Exist("/sys/class/power_supply/BAT0/", True) Then
Label177.Text = "Alarm: " & battery.alarm
Label178.Text = "Capacity: " & battery.capacity
Label179.Text = "Charge full: " & battery.charge_full
Label180.Text = "Charge full design: " & battery.charge_full_design
Label181.Text = "Charge now: " & battery.charge_now
Label182.Text = "Current now: " & battery.current_now
Label183.Text = "Cycle count: " & battery.cycle_count
Label184.Text = "Manufacturer: " & battery.manufacturer
Label185.Text = "Model name: " & battery.model_name
Label186.Text = "Present: " & battery.Present
Label187.Text = "Serial number: " & battery.serial_number
Label188.Text = "Status: " & battery.status
Label189.Text = "Technology: " & battery.technology
Label190.Text = "Battery type: " & battery.battery_type
Label191.Text = "Voltage min design: " & battery.voltage_min_design
Label192.Text = "Voltage now: " & battery.voltage_now
Endif
End
Public Sub Button7_Click()
Dim packages As String
If Exist("/var/lib/dpkg/status")
Shell "grep \"^Status: install ok installed\" /var/lib/dpkg/status | wc -l" Wait To packages
Endif
If ChkPrm.ChkExec("rpm") = True And IsNull(packages) = True Then
Shell "rpm -qa | wc -l" Wait To packages
Endif
If ChkPrm.ChkExec("pacman") = True Then
Shell "pacman -Q|wc -l" Wait To packages
Endif
TextLabel21.Visible = True
TextLabel21.Text = packages & " Packages are installed "
End
Public Sub Button10_Click()
Object.Call(battery, "_inits")
Logs("Battery initial", Logger.Info)
End
Public Sub ComboBox3_Click()
Inc Application.Busy
Disk_Drives.get_informations()
refreshing()
Dec Application.Busy
End
Public Sub ComboBox4_Click()
Inc Application.Busy
Disk_Drives._init_2()
Disk_Drives.get_informations()
refreshing()
Dec Application.Busy
End
Public Sub refreshing()
TextBox29.Text = "Model: " & Disk_Drives.device_model
TextBox30.Text = "Vendor: " & Disk_Drives.device_vendor
Label38.Text = "Part size: " & Disk_Drives.partition_size
Label250.Text = "Disk size: " & Disk_Drives.real_size
Label39.Text = "Filesystem: " & Disk_Drives.filesystem_type
Label41.Text = "Device rev: " & Disk_Drives.device_rev
Label42.Text = "Max sectors: " & Disk_Drives.max_sectors
Label43.Text = "State: " & Disk_Drives.device_state
Label44.Text = "Modalias: " & Disk_Drives.modalias
Label46.Text = "Ext range: " & Disk_Drives.ext_range
Label47.Text = "Range: " & Disk_Drives.range
Label49.Text = "Add random: " & Disk_Drives.add_random
Label49.Tooltip = "This file allows to trun off the disk entropy contribution. \n"
"Default value Of this file Is '1'(on)."
Label50.Text = "Discard granularity: " & Disk_Drives.discard_granularity
Label50.Tooltip = "This shows the size of internal allocation of the device in bytes,\n"
"if reported by the device. \n"
"A value Of '0' means device does not support the discard functionality."
Label51.Text = "Discard max bytes: " & Disk_Drives.discard_max_bytes
Label51.Tooltip = "Devices that support discard functionality may have internal limits on\n"
"the number Of bytes that can be trimmed Or unmapped In a single operation.\n"
"The discard_max_bytes parameter Is Set by the device driver\n"
"To the maximum number Of bytes that can be discarded In a single operation.\n"
"Discard requests issued To the device must Not exceed this limit.A discard_max_bytes\n"
"value Of 0 means that the device does Not support discard functionality."
Label52.Text = "Discard zeroes data: " & Disk_Drives.discard_zeroes_data
Label52.Tooltip = "When read, this file will show if the discarded block are zeroed by the device Or not.\n"
"If its value Is '1' the blocks are zeroed otherwise not.\n"
Label53.Text = "HW sector size: " & Disk_Drives.hw_sector_size
Label53.Tooltip = "This is the hardware sector size of the device, in bytes."
Label54.Text = "Max HW sectors kb: " & Disk_Drives.max_hw_sectors_kb
Label54.Tooltip = "This is the maximum number of kilobytes supported in a single data transfer."
Label55.Text = "Max sectors kb: " & Disk_Drives.max_sectors_kb
Label55.Tooltip = "This is the maximum number of kilobytes that the block layer will allow\n"
"For a filesystem request.\n"
"Must be smaller than Or equal To the maximum size allowed by the hardware."
Label56.Text = "Max segments: " & Disk_Drives.max_segments
Label56.Tooltip = "Maximum number of segments of the device."
Label57.Text = "Max segment size: " & Disk_Drives.max_segment_size
Label57.Tooltip = "Maximum segment size of the device."
Label58.Text = "Read ahead kb: " & Disk_Drives.read_ahead_kb
Label59.Text = "..:Scheduler:.. \n " & Disk_Drives.scheduler
Label126.Text = "Logical block size: " & Disk_Drives.logical_block_size
Label126.Tooltip = "This is the logcal block size of the device, in bytes."
Label127.Text = "IO stats: " & Disk_Drives.iostats
Label128.Text = "Minimum IO size: " & Disk_Drives.minimum_io_size
Label128.Tooltip = "This is the smallest preferred io size reported by the device."
Label129.Text = "Nomerges: " & Disk_Drives.nomerges
Label130.Text = "Nr requests: " & Disk_Drives.nr_requests
Label131.Text = "Optimal IO size: " & Disk_Drives.optimal_io_size
Label131.Tooltip = "This is the optimal io size reported by the device."
Label132.Text = "Physical block size: " & Disk_Drives.physical_block_size
Label133.Text = "Rotational: " & Disk_Drives.rotational
Label134.Text = "Rq affinity: " & Disk_Drives.rq_affinity
Label123.Text = "BDI max_ratio: " & Disk_Drives.max_ratio
Label124.Text = "BDI min_ratio: " & Disk_Drives.min_ratio
Label125.Text = "BDI stable pages required: " & Disk_Drives.stable_pages_required
Label45.Text = Choose(CInt(CVariant(Disk_Drives.removable)) + 1, "Removable: No", "Removable: Yes")
' If Disk_Drives.removable Like "0" Then
' Label45.Text = "Removable: No"
' Endif
'
' If Disk_Drives.removable Like "1" Then
' Label45.Text = "Removable: Yes"
' Endif
If IsNull(ComboBox3.Text) = False Then
If Disk_Drives.check_swap Like "*" & ComboBox3.Text & "*" Then
Label48.Visible = True
Try ProgressBar2.Value = Disk_Drives.SWAP_USED / Disk_Drives.SWAP_TOTAL
Else
Label48.Visible = False
Endif
Else
Label48.Visible = False
Endif
TextBox48.Text = Disk_Drives.mount_point
TextBox52.Text = Disk_Drives.device_uuid
TextBox53.Text = Disk_Drives.mount_widtch
Label16.Text = Disk_Drives.CONNECTED_PORT
Label17.Text = Disk_Drives.Logical_Size
Label251.Text = "HW SATA SPD Limit:" & Space$(2) & Disk_Drives.hw_sata_spd_limit
Label251.Tooltip = "Maximum speed supported by the connected SATA device."
'Max HDD/SSD Sata Speed :-)
Label252.Text = "SATA SPD:" & Space$(2) & Disk_Drives.sata_spd
Label252.Tooltip = "Current speed of the link [1.5, 3Gps,...]."
':-)
Label253.Text = "SATA SPD Limit:" & Space$(2) & Disk_Drives.sata_spd_limit
Label253.Tooltip = "Maximum speed imposed by libata."
':-)
'USB Begin
Label122.Text = "USB Speed:" & Space$(2) & Disk_Drives.USB_SPEED
Label254.Text = "USB Version:" & Space$(2) & Disk_Drives.USB_VERSION
Label255.Text = "USB Max Power:" & Space$(2) & Disk_Drives.USB_BMAXPOWER
'Set Pictures for USB
PictureBox5.Picture = Disk_Drives.USB_PIC
PictureBox4.Picture = Disk_Drives.SATA_PIC
If Disk_Drives.USB_SPEED = Null Then
Panel2.Visible = False
Else
Panel2.Visible = True
Endif
If Disk_Drives.sata_spd = Null Then
Panel1.Visible = False
Else
Panel1.Visible = True
Endif
End
Public Sub ComboBox5_Click()
Inc Application.Busy
USB_Drives.get_informations()
Dec Application.Busy
End
Public Sub ComboBox6_Click()
Inc Application.Busy
Asound_Drives._get_informations()
Dec Application.Busy
End
Public Sub ComboBox7_Click()
Inc Application.Busy
Input_Devices._get_informations()
Dec Application.Busy
End
Public Sub Button12_Click()
FReport_Gen.Show
End
Public Sub Timer1_Timer()
''Refresh temp 1500/ms
dospam_uptime()
'Check for temperature on this machine is supported.
'See "thermal_zone". You can add own code.
thermal_zone._inits
If thermal_zone.supporttemp = True Then
LCDLabel1.Text = Replace("Temp: " & (thermal_zone.calculate / 1000) & " °C", ".", " . ")
Else
LCDLabel1.Visible = False
Endif
'Check if critical temperature is supported.
'See "thermal_zone". You can add own code.
If thermal_zone.supportcritical = True Then
LCDLabel2.Text = Replace("Crit: " & (thermal_zone.calculatecrit / 1000) & " °C", ".", " . ")
Else
LCDLabel2.Visible = False
Endif
'Try to show VCore temperatures.
Try LCDLabel3.Text = VCore.CoreVoltage
Try LCDLabel3.Visible = VCore.Visible
'Fix me if english translation is wrong.
MCPUSAGE.proc_stat()
'Check if processor support cpufreq
'cpu0 is always exist in all computers
'don't need check current text of combobox
If Exist("/sys/devices/system/cpu/cpu0/cpufreq") = True Then
Refresh_CPU_MHZ()
Endif
End
Public Sub Button6_Click()
FModules.Show
End
Public Sub ComboBox2_Click()
Inc Application.Busy
Network.get_informations_about_net_interface()
TextBox56.Text = Network.subsystem_device
TextBox57.Text = Network.subsystem_vendor
TextArea4.Text = Network.lspci
Dec Application.Busy
End
Public Sub Button9_Click()
FNET_R_T.Show
End
Public Sub ComboBox8_Click()
Object.Call(FGraphic, "_check")
End
Public Sub Button15_Click()
Clipboard.Copy(TextBox58.Text)
End
Public Sub Orientation_Top_Click()
TabStrip1.Orientation = Align.Top
Me.W = Int(Label25.X + 365)
TabStrip1.W = Int(Label25.X + 365)
Button1.X = Int(Label25.X + 300)
End
Public Sub Orientation_Bottom_Click()
TabStrip1.Orientation = Align.Bottom
Me.W = Int(Label25.X + 365)
TabStrip1.W = Int(Label25.X + 365)
Button1.X = Int(Label25.X + 300)
End
Public Sub Orientation_Left_Click()
TabStrip1.Orientation = Align.Left
Me.W = Int(Label25.X + 390)
TabStrip1.W = Int(Label25.X + 390)
Button1.X = Int(Label25.X + 325)
End
Public Sub Orientation_Right_Click()
TabStrip1.Orientation = Align.Right
Me.W = Int(Label25.X + 390)
TabStrip1.W = Int(Label25.X + 390)
Button1.X = Int(Label25.X + 325)
End
Public Sub Reportthisw_Click()
Select Case TabStrip1.Current.Text
Case "CPU"
FReport_Gen.CheckBox1.Value = True
Case "GPU"
FReport_Gen.CheckBox3.Value = True
Case "Mobo"
FReport_Gen.CheckBox2.Value = True
Case "Audio"
FReport_Gen.CheckBox4.Value = True
Case "Drives"
FReport_Gen.CheckBox14.Value = True
Case "System"
FReport_Gen.CheckBox5.Value = True
Case "Kernel"
FReport_Gen.CheckBox12.Value = True
End Select
FReport_Gen.Show
End
Public Sub TabStrip1_Click()
TabPanel1_Click()
If TabStrip1.Current.Text Like "*CPU*" Then
ComboBox1.Visible = True
'MenuButton1.Visible = True
Else
ComboBox1.Visible = False
'MenuButton1.Visible = False
Endif
If TabStrip1.Current.Text Like "*GPU*" Then
ComboBox8.Visible = True
Button11.Visible = True
Else
ComboBox8.Visible = False
Button11.Visible = False
Endif
If TabStrip1.Current.Text Like "*Drives*" Then
HBox19.Visible = True
Else
HBox19.Visible = False
Endif
If TabStrip1.Current.Text Like "*Memory*" Then
HBox19.Visible = False
ComboBox10.Visible = True
Else
ComboBox10.Visible = False
Endif
If TabStrip1.Current.Text Like "*Kernel*" Then
Button6.Visible = True
Else
Button6.Visible = False
Endif
Me.Text = "I-Nex / " & TabStrip1.Current.Text
End
Public Sub Button11_Click()
FEDID.Show
End
Public Sub Button16_Click()
TabPanel1.Index = 1
End
Public Sub TabPanel1_Click()
If TabPanel1.Current.Text = "CPUID" Then
ComboBox1.Visible = False
'MenuButton1.Visible = False
Else If TabPanel1.Current.Text = "CPUINFO" Then
ComboBox1.Visible = True
'MenuButton1.Visible = True
Else If TabPanel1.Current.Text = "FLAGS" Then
ComboBox1.Visible = False
Else
ComboBox1.Visible = False
'MenuButton1.Visible = False
Endif
End
Public Sub Buttongroup_Click()
Desktop.Open("" & Last.Name & "")
End
Public Sub ComboBox9_Click()
Asound_Drives._INPUT_NAME()
End
Public Sub Button1_Click()
Form_Close()
End
Public Sub Form_Move()
Settings["Window/X"] = Me.X
Settings["Window/Y"] = Me.Y
End
Public Sub Form_CloseWindows()
FCopyUrl.Close
FInputDate.Close
FDirDialog.Close
FFileDialog.Close
FModules.Close
FEDID.Close
FNET_R_T.Close
FSystemInfo.Close
FValidate.Close
ScreenShot.Close
FReport_Gen.Close
End
Public Sub Form_Close()
Form_CloseWindows()
Settings["Window/X"] = Me.X
Settings["Window/Y"] = Me.Y
Settings["Tab/Pos"] = TabStrip1.Orientation
Logs("Good bye!", Logger.Info)
'MLibcpuid.DATAT.Clear
Me.Close
End
Public Sub MenuButton1_Click()
Dim URL As String
Inc Application.Busy
VALIDATE._inits()
URL = VALIDATE.SendReportToServer(User.Home & "/.i-nex/VALID", "Validate", "http://127.0.0.1/", Settings["Cerbero/USERNAME"], Settings["Cerbero/API"])
FCopyUrl.TextBox1.Text = URL
FCopyUrl.Show
Dec Application.Busy
End
Public Sub Savevalid_Click()
VALIDATE._inits()
Dialog.SaveFile
If Exist(Dialog.Path) = True Then
Kill Dialog.Path
Endif
Try Copy User.Home & "/.i-nex/VALID" To Dialog.Path
If Error Then
Logs("Not chosen where you want to save the report", Logger.Error)
Endif
End
Public Sub Button17_Click()
Desktop.Open("https://www.google.com/maps/search/" & Label237.Text & "")
End
Public Sub Button18_Click()
FSystemInfo.Show
End
Public Sub Button19_Click()
Network.IP_INFO()
End
Public Sub Button20_Click()
Disk_Drives._inits()
Disk_Drives._init_2()
End
Public Sub ComboBox10_Click()
MDecode_dimms._inits()
End