' 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 Product As String
Public bMaxPower As String
Public manufacturer As String
Public speed As String
Public Version As String
Public idProduct As String
Public idVendor As String
Public Serial As String
Public lsusb As String
Public ListAllDiscs As String

Public Sub _inits()
  Finfosys.ComboBox5.List = Dir("/sys/bus/usb/devices/", "*[0-9]*")
  Finfosys.ComboBox5.Index = 0
End

Public Sub get_informations()
 Try Finfosys.TextBox40.Text = Replace(File.Load("/sys/bus/usb/devices/" & Finfosys.ComboBox5.Text & "/product"), "\n", "")
 Try Finfosys.TextBox41.Text = Replace(File.Load("/sys/bus/usb/devices/" & Finfosys.ComboBox5.Text & "/bMaxPower"), "\n", "")
 Try Finfosys.TextBox42.Text = Replace(File.Load("/sys/bus/usb/devices/" & Finfosys.ComboBox5.Text & "/manufacturer"), "\n", "")
 Try Finfosys.TextBox46.Text = Replace(File.Load("/sys/bus/usb/devices/" & Finfosys.ComboBox5.Text & "/speed"), "\n", "") & " MB"
 Try Finfosys.TextBox49.Text = Replace(File.Load("/sys/bus/usb/devices/" & Finfosys.ComboBox5.Text & "/version"), "\n", "")
 Try Finfosys.TextBox50.Text = Replace(File.Load("/sys/bus/usb/devices/" & Finfosys.ComboBox5.Text & "/idProduct"), "\n", "")
 Try Finfosys.TextBox51.Text = Replace(File.Load("/sys/bus/usb/devices/" & Finfosys.ComboBox5.Text & "/idVendor"), "\n", "")
 Try Finfosys.TextBox54.Text = Replace(File.Load("/sys/bus/usb/devices/" & Finfosys.ComboBox5.Text & "/serial"), "\n", "")
 Shell "lsusb -d " & idVendor & ":" & idProduct & "" Wait To lsusb
 lsusb = Replace(lsusb, "\n", "")
 Finfosys.TextBox46.Text = speed & " MB"
 Finfosys.TextBox43.Text = lsusb
End
