[vwnc] USB device change

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

[vwnc] USB device change

Dziedzic, Peter

Hello,

is there one possibility to get a event in smalltalk when a USB-device will be inserted or removed from the computer?
I need to catch the
WM_DEVICECHANGE Message
(see:  http://msdn.microsoft.com/en-us/library/aa363480(VS.85).aspx )
Does anyone knows a possbile solution how to do this?
Thanks.

best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany
e-mail: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346




----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] USB device change

Reinout Heeck
>
> is there one possibility to get a event in smalltalk when a USB-
> device will be inserted or removed from the computer?
> I need to catch the WM_DEVICECHANGE Message (see:  http://msdn.microsoft.com/en-us/library/aa363480(VS.85).aspx 
>  )
> Does anyone knows a possbile solution how to do this?



There is fair chance that the image already receives these events but  
does nothing with them.


See InputState>>processUnknownEvent:for:
and InputState>>processUnboundEvent:

Documentation at InputState class>>hostEvent

Note that those methods run in a special process, if you interrupt it  
(e.g. with a breakpoint) your image goes limp...



R
-

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

[vwnc] Antwort: Re: USB device change

Dziedzic, Peter

hello,

thanks for your help.
i can catch this event but even when i only open a dialog then the image goes limp.
so how can i do? is opening a separate thread a possible solution?
thanks.

best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany
e-mail: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346





Reinout Heeck <[hidden email]>
Gesendet von: [hidden email]

23.02.2009 18:55

An
VW NC <[hidden email]>
Kopie
Thema
Re: [vwnc] USB device change





>
> is there one possibility to get a event in smalltalk when a USB-
> device will be inserted or removed from the computer?
> I need to catch the WM_DEVICECHANGE Message (see:  http://msdn.microsoft.com/en-us/library/aa363480(VS.85).aspx
>  )
> Does anyone knows a possbile solution how to do this?



There is fair chance that the image already receives these events but  
does nothing with them.


See InputState>>processUnknownEvent:for:
and InputState>>processUnboundEvent:

Documentation at InputState class>>hostEvent

Note that those methods run in a special process, if you interrupt it  
(e.g. with a breakpoint) your image goes limp...



R
-

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc



----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] USB device change

Reinout Heeck-2
In reply to this post by Reinout Heeck
Reinout Heeck wrote:
> There is fair chance that the image already receives these events but  
> does nothing with them.
>
>  
So I'm near a Windoze machine now and couldn't resist tinkering :-)



If you implement the following you should see USB events in the transcript:

InputState>>
processUnknownEvent: event for: aWindow
 
    | hostEvent |
    hostEvent := event at: 10.
    (hostEvent longAt: 9) = 537
        ifTrue:
            [Transcript
                cr;
                nextPutAll: 'device change event: ';
                print: (hostEvent longAt: 1);
                space;
                print: (hostEvent longAt: 5);
                space;
                print: (hostEvent longAt: 9);
                space;
                print: (hostEvent longAt: 13);
                space;
                print: (hostEvent unsignedLongAt: 17)].




Clearly the above code is not cross platform ;-)

R
-

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Antwort: Re: USB device change

Reinout Heeck-2
In reply to this post by Dziedzic, Peter

>
> i can catch this event but even when i only open a dialog then the
> image goes limp.
> so how can i do? is opening a separate thread a possible solution?
> thanks.

A quick hack would be to put a SharedQueue in some global, and have your
code in InputState copy events into that queue.

Some other process can then remove events from this queue without
breaking the InputState process.

For robustness you may later want to make your own subclass of
SharedQueue witch limits the growth to some max size (in case more
events arrive into the queue than the consumer process can remove).


Note that you need to *copy* the event, the original event object gets
re-used by the VM when the next event arrives.
See InputState>>copyEvent:



HTH,

R
-



--
*********************************************************************

Dit e-mailbericht is alleen bestemd voor de geadresseerde(n).

Gebruik door anderen is niet toegestaan. Indien u niet degeadresseerde(n) bent wordt u verzocht de verzender hiervan op de hoogte te stellen en het bericht te verwijderen. Door de elektronische verzending kunnen aan de inhoud van dit bericht geen rechten worden ontleend.

Soops B.V. is gevestigd te Amsterdam, Nederland, en is geregistreerd bij de Kamer van Koophandel onder nummer 33240368.
Soops B.V. levert volgens de Fenit voorwaarden, gedeponeerd te Den Haag op 8 december 1994 onder nummer 1994/189.
**********************************************************************

This e-mail message is intended to be exclusively for the addressee.

If you are not the intended recipient you are kindly requested not to make any use whatsoever of the contents and to notify the sender immediately by returning this e-mail message. No rights can be derived from this message.

Soops B.V. is a private limited liability company and has its seat at Amsterdam, The Netherlands and is registered with the Trade Registry of the Chamber of Commerce and Industry under number 33240368.
Soops B.V. delivers according to the General Terms and Conditions of Business of Fenit, registered at The Hague, The Netherlands on December 8th, 1994, under number 1994/189
**********************************************************************


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

[vwnc] Antwort: Re: Antwort: Re: USB device change

Dziedzic, Peter

Hello,

thanks for your help.
i will try to implement it as a global queue.
thanks.

best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany
e-mail: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346





Reinout Heeck <[hidden email]>
Gesendet von: [hidden email]

24.02.2009 11:04

An
VW NC <[hidden email]>
Kopie
Thema
Re: [vwnc] Antwort: Re:  USB device change






>
> i can catch this event but even when i only open a dialog then the
> image goes limp.
> so how can i do? is opening a separate thread a possible solution?
> thanks.

A quick hack would be to put a SharedQueue in some global, and have your
code in InputState copy events into that queue.

Some other process can then remove events from this queue without
breaking the InputState process.

For robustness you may later want to make your own subclass of
SharedQueue witch limits the growth to some max size (in case more
events arrive into the queue than the consumer process can remove).


Note that you need to *copy* the event, the original event object gets
re-used by the VM when the next event arrives.
See InputState>>copyEvent:



HTH,

R
-



--
*********************************************************************

Dit e-mailbericht is alleen bestemd voor de geadresseerde(n).

Gebruik door anderen is niet toegestaan. Indien u niet degeadresseerde(n) bent wordt u verzocht de verzender hiervan op de hoogte te stellen en het bericht te verwijderen. Door de elektronische verzending kunnen aan de inhoud van dit bericht geen rechten worden ontleend.

Soops B.V. is gevestigd te Amsterdam, Nederland, en is geregistreerd bij de Kamer van Koophandel onder nummer 33240368.
Soops B.V. levert volgens de Fenit voorwaarden, gedeponeerd te Den Haag op 8 december 1994 onder nummer 1994/189.
**********************************************************************

This e-mail message is intended to be exclusively for the addressee.

If you are not the intended recipient you are kindly requested not to make any use whatsoever of the contents and to notify the sender immediately by returning this e-mail message. No rights can be derived from this message.

Soops B.V. is a private limited liability company and has its seat at Amsterdam, The Netherlands and is registered with the Trade Registry of the Chamber of Commerce and Industry under number 33240368.
Soops B.V. delivers according to the General Terms and Conditions of Business of Fenit, registered at The Hague, The Netherlands on December 8th, 1994, under number 1994/189
**********************************************************************


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc



----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc