' Gambas module 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 Logs As New Logger
Public Name As String
Public Phys As String
Public Modalias As String

Public Sub _inits()
 
  Dim ListAllDiscs, risultato As String
  Dim righe As New String[]
  Dim count As Integer
  Dim riga As New String[]
  Dim lista As New String[]
  Logs("Add Input Devices to ComboBox..", Logger.Info)
  Shell "ls /sys/class/input/input[0-9]/name | tail | cut -d '/' -f 5" To ListAllDiscs
  righe = Split(ListAllDiscs, "\n", "%%", True)
  For count = 0 To righe.Max
  riga = Split(righe[count], " ", "%%", True)
  risultato = Replace(riga[0], " ", "")
  lista.add(risultato)
  Next
  Finfosys.ComboBox7.List = lista
  Finfosys.ComboBox7.Index = 0
 
End

Public Sub _get_informations()
 Try Finfosys.Label82.Text = "Name:   " & Replace(File.Load("/sys/class/input/" & Finfosys.ComboBox7.Text & "/name"), "\n", "")
 Try Finfosys.Label83.Text = "Phys:   " & Replace(File.Load("/sys/class/input/" & Finfosys.ComboBox7.Text & "/phys"), "\n", "")
 Try Finfosys.TextBox45.Text = Replace(File.Load("/sys/class/input/" & Finfosys.ComboBox7.Text & "/modalias"), "\n", "")
End

