Go Back   Wireless and Wifi Forums > News > Newsgroups > alt.comp.hardware
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-28-2005, 07:43 PM
Johnson
Guest
 
Posts: n/a
Default A newbie question about USB

A newbie question about USB.
I am developing a PC application (not driver) to communicate with a USB
2.0 slave peripheral device. I would like to know, if my application
has built a connection and is talking to the USB peripheral, and I
disconnect the cable suddenly, will the application be able to identify
the event automatically, or it will still stay with the "connection"?
Another problem, if I re-connect the usb cable, will the connection be
automatically restored? Should I close my application first and then
start it again to create a connection with the USB peripheral?
Thanks in advance.
Johnson


Reply With Quote
  #2 (permalink)  
Old 09-29-2005, 03:13 AM
Skeleton Man
Guest
 
Posts: n/a
Default Re: A newbie question about USB

>A newbie question about USB.
>I am developing a PC application (not driver) to communicate with a USB
>2.0 slave peripheral device. I would like to know, if my application
>has built a connection and is talking to the USB peripheral, and I
>disconnect the cable suddenly, will the application be able to identify
>the event automatically, or it will still stay with the "connection"?
>Another problem, if I re-connect the usb cable, will the connection be
>automatically restored? Should I close my application first and then
>start it again to create a connection with the USB peripheral?
>Thanks in advance.
>Johnson


This is all driver dependant behaviour.. your software would constantly poll
the driver to find out the current status (connected, disconnected, etc).

The code might look something like this:

while (usb->connected() == true){
usb->read_from_device();
usb->write_to_device();
}

The driver is responsible for handling hardware events such as
connecting/disconnected a USB device.

You might want to post to the appropriate software group for the language you
are developing in (C, C++, etc).

Regards,
Chris



----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----

Reply With Quote
  #3 (permalink)  
Old 09-29-2005, 04:05 PM
Johnson
Guest
 
Posts: n/a
Default Re: A newbie question about USB

Thank you, Chris. I had a few more questions.

1) Could two PC applications work on the same USB port? How to avoid
confliction?

2) Are the PC applications able to check the type of the USB
peripherals connected? If so I can let the first PC application
"active" when USB peripheral A is detected, and the second PC
application "active" when USB peripheral B is detected. This way
multiple PC applications can work together with one physical USB port.

3) I guess the firmware running inside of the USB slave peripherals
(not driver), has the similar behavior to the PC application's, right?
I guess the codes for the firmware also look like:
while (usb->connected() == true){
usb->read_from_device();
usb->write_to_device();
}

Johnson


Reply With Quote
  #4 (permalink)  
Old 09-29-2005, 06:21 PM
Skeleton Man
Guest
 
Posts: n/a
Default Re: A newbie question about USB

>1) Could two PC applications work on the same USB port? How to avoid
>confliction?


Yes.. for example you install printer drivers and camera drivers onto the PC.
You can connect either device to any USB port and the OS knows which software to
launch. I'm sure there are also methods to launch a generic application
regardless of which device is connected.

>2) Are the PC applications able to check the type of the USB
>peripherals connected? If so I can let the first PC application
>"active" when USB peripheral A is detected, and the second PC
>application "active" when USB peripheral B is detected. This way
>multiple PC applications can work together with one physical USB port.


Again it would be the job of the driver to report the type and identity of the
device connected. I should assume most API's would have a simple method that is
called for this (e.g. device_id = usb->probe()). This method would probe the
device with some generic command, which instructs the firmware to report basic
information (like ID, version, etc).

>3) I guess the firmware running inside of the USB slave peripherals
>(not driver), has the similar behavior to the PC application's, right?
>I guess the codes for the firmware also look like:
>while (usb->connected() == true){
> usb->read_from_device();
> usb->write_to_device();
>}


I should think the firmware would function in much the same way as the drives
yes, but don't take my word on it. I'm not a developer of USB or any hardware
based communications, I'm largely a web programmer (my experience with devices
is based on paralell/serial communications, I've never worked with USB).

Again you would be best to post to a software group as they would be much more
knowledgable.

Regards,
Chris



----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----

Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie Question - about using a DECT SIP phone and port forwarding ? Roger Baker uk.telecom.voip 11 02-07-2007 10:56 PM
Newbie question about SATA connections Phil Latio alt.comp.hardware 2 08-31-2006 08:31 AM
Dumb Newbie Question Kenny alt.internet.wireless 3 08-25-2006 05:02 PM
Complete Voip newbie question john@coedana.plus.com uk.telecom.voip 5 10-30-2005 06:31 PM
question from a newbie about hard drives and making backups newsgroupkirky@sbcglobal.net alt.comp.hardware 16 08-22-2005 09:34 AM


All times are GMT. The time now is 09:42 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45