Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 18:32 27 Apr 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Monitoring the USB state

Author Message
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5905
Posted: 01:37pm 11 Jul 2013
Copy link to clipboard 
Print this post

Geoff,
would it be possible add another Read Only Variable:
MM.USB to indicate when the Maximite is plugged into a USB host. (This would not guarantee any intelligence on the PC end.)

maybe even an interrupt:
ON USB goto xxxx
MM Basic already sends the welcome message when the USB comes up.

or is there a PEEK that does the job for me?

Jim

VK7JH
MMedit   MMBasic Help
 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3165
Posted: 05:31pm 11 Jul 2013
Copy link to clipboard 
Print this post

You could use either of these two:
IF (PEEK(&HBF88, &H5060) AND 1) = 1 THEN PRINT "+5V is on the USB connector"
or
IF (PEEK(&HBF88, &H5060) AND &B100000) = 0 THEN PRINT "There is a valid USB session"


Note that the second one means that there is a computer host connected to the USB (it does not tell you that there is a a terminal emulator running on it - that is much harder).

GeoffEdited by Geoffg 2013-07-13
Geoff Graham - http://geoffg.net
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5905
Posted: 05:59pm 11 Jul 2013
Copy link to clipboard 
Print this post

Thanks Geoff,
those 2 options will keep me happy.

Jim
VK7JH
MMedit   MMBasic Help
 
vk2sja
Newbie

Joined: 07/06/2013
Location: Australia
Posts: 26
Posted: 05:20am 13 Jul 2013
Copy link to clipboard 
Print this post

  Geoffg said   (it does not tell you that there is a a terminal emulator running on it - that is much harder).


Not sure if this is required/helpful but it seems that if you fire "ESC [0c" (that's zero c, and remove the spaces) off at the unknown device at the other end of your USB come serial link. Then if there is a DEC VT100 terminal emulator of some sort at the other end it should respond with "ESC [?1;#c" where the # is a number between 0 and 7.

That's the DEC VT100 DA – Device Attributes ESC sequence.
See: http://www.vt100.net/docs/vt100-ug/chapter3.html

You could use this to see if you have a live VT100.

Haven't tried it yet.

Mileage may vary depending on how good the emulator is. Linux XTerm does seem to support it
http://invisible-island.net/xterm/ctlseqs/ctlseqs.html



 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024