Re: [Gambas-user] Gambas2 USB detect !!??

2009-01-03 Thread Emil Tchekov


 drive.  I haven't hooked any USB drives up to my Ubuntu server since I
 upgraded so I don't know if every distro has logs that look like that, or
 just Mandriva.

 Rob

Good idea - /var/log/messages should be present on every linux

looking in there can provide interesting infos... (be base for usefull GUI 
apps). May be coupled with comparing current time / log time in order to look 
only for current events...

The problem ist - as normal user you are not allowed to read it...


regards


Emil


--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Gambas2 USB detect !!??

2009-01-03 Thread Rolf Schmidt
Am Samstag, 3. Januar 2009 schrieb Emil Tchekov:
  drive.  I haven't hooked any USB drives up to my Ubuntu server since I
  upgraded so I don't know if every distro has logs that look like that, or
  just Mandriva.
 
  Rob

 Good idea - /var/log/messages should be present on every linux

 looking in there can provide interesting infos... (be base for usefull GUI
 apps). May be coupled with comparing current time / log time in order to
 look only for current events...

 The problem ist - as normal user you are not allowed to read it...

You (or better the administrator) can create a named pipe (with mknod) and 
direct parts of the log infos additionally to this named pipe. So the 
syslog.conf needs to be edited and a line like kern.info | YourNamedPipe
may be added, which say, the all the log messeages from the kernel shout 
additional go throug the named pipe. Of course the syslog-daemen needs to be 
restartet or instructed to reread its config file.

Hope that helps
Rolf



signature.asc
Description: This is a digitally signed message part.
--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


[Gambas-user] Gambas2 USB detect !!??

2009-01-02 Thread Biggy UAC
Happy new year !

in my application i want to detect usb flash drive when pluged/unpluged and
display in a textbox usb drive letter.

how to detect usb drive stick plug/unplug in gambas2 ??

thanks .
--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Gambas2 USB detect !!??

2009-01-02 Thread Benoit Minisini
On vendredi 2 janvier 2009, Biggy UAC wrote:
 Happy new year !

 in my application i want to detect usb flash drive when pluged/unpluged and
 display in a textbox usb drive letter.

 how to detect usb drive stick plug/unplug in gambas2 ??

 thanks .

USB driver letter ??? That does not exist on Linux...

Anyway, this is not possible in Gambas 2 directly.

AFAIK, when you plug a device, the kernel warns the HAL daemon which then 
sends a signal on the DBUS system bus. This signal then can be catched by any 
application that ask for it on the DBUS system bus.

You cannot do that in Gambas without support for DBUS.

Maybe there is another way with a command-line tool, but I don't know.

Regards,

-- 
Benoit Minisini

--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user


Re: [Gambas-user] Gambas2 USB detect !!??

2009-01-02 Thread Rob
On Friday 02 January 2009 12:54, Biggy UAC wrote:
 in my application i want to detect usb flash drive when pluged/unpluged
 and display in a textbox usb drive letter.
 how to detect usb drive stick plug/unplug in gambas2 ??

Linux doesn't have drive letters, but you should be able to get the device 
name (e.g. /dev/sde) in a couple of different ways.

The correct way to do it is to set your program up as a hotplug agent for 
USB drives using udev (probably putting a file in /etc/udev/rules.d).  But 
doing that may screw up your users' normal hotplug functionality (i.e. KDE 
or GNOME asking the user what they want to do with the drive.)  Google for 
udev hotplug for more information on this, because I've never done it 
myself.  Also, on older systems the devfs system was used rather than udev 
and you'd need to deal with /etc/hotplug/usb.usermap (I think.)

Another way, less intrusive but by no means foolproof, is to have a process 
running in your Gambas program, tail -f /var/log/messages 
or tail -f /var/log/syslog.  Here is what appeared in /var/log/messages 
last night on one of my Mandriva boxes when I attached my Archos hard disk 
jukebox:

Jan  1 20:46:59 raindog2 kernel: usb 5-5: new high speed USB device using 
ehci_hcd and address 7
Jan  1 20:46:59 raindog2 kernel: usb 5-5: configuration #1 chosen from 1 
choice
Jan  1 20:46:59 raindog2 kernel: scsi7 : SCSI emulation for USB Mass 
Storage devices
Jan  1 20:47:04 raindog2 kernel:   Vendor: ArchosModel: PC Hard Drive 
Rev: 0316
Jan  1 20:47:04 raindog2 kernel:   Type:   Direct-Access  
ANSI SCSI revision: 02
Jan  1 20:47:04 raindog2 kernel: SCSI device sdh: 312175080 512-byte hdwr 
sectors (159834 MB)
Jan  1 20:47:04 raindog2 kernel: sdh: Write Protect is off
Jan  1 20:47:04 raindog2 kernel: sdh: assuming drive cache: write through
Jan  1 20:47:04 raindog2 kernel: SCSI device sdh: 312175080 512-byte hdwr 
sectors (159834 MB)
Jan  1 20:47:04 raindog2 kernel: sdh: Write Protect is off
Jan  1 20:47:04 raindog2 kernel: sdh: assuming drive cache: write through
Jan  1 20:47:04 raindog2 kernel:  sdh: sdh1
Jan  1 20:47:04 raindog2 kernel: sd 7:0:0:0: Attached scsi removable disk 
sdh

If you look for the words Attached scsi removable disk in the output of 
that tail -f, the next word in that line should be the device name of the 
drive.  I haven't hooked any USB drives up to my Ubuntu server since I 
upgraded so I don't know if every distro has logs that look like that, or 
just Mandriva.

Rob

--
___
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user