A computer components & hardware forum. HardwareBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » HardwareBanter forum » General Hardware & Peripherals » General
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

A newbie question about USB



 
 
Thread Tools Display Modes
  #1  
Old September 28th 05, 08:43 PM
Johnson
external usenet poster
 
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

  #2  
Old September 29th 05, 04:13 AM
Skeleton Man
external usenet poster
 
Posts: n/a
Default

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 =----
  #3  
Old September 29th 05, 05:05 PM
Johnson
external usenet poster
 
Posts: n/a
Default

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

  #4  
Old September 29th 05, 07:21 PM
Skeleton Man
external usenet poster
 
Posts: n/a
Default

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 =----
 




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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ok go easy on this newbie. Barebones question Building my first Aurora Asus Motherboards 8 November 7th 04 05:46 AM
RAID 1 newbie question - non identical disks Matt Fletcher Homebuilt PC's 8 August 10th 04 09:42 PM
Isobuster Newbie Question David J Rainey Cdr 1 June 11th 04 01:52 AM
Newbie VCD Question! Help! LADYAUSSIEFAN Cdr 26 January 3rd 04 07:48 AM
Quick IDE cable question (newbie) Gabagimpy Homebuilt PC's 7 December 23rd 03 02:07 PM


All times are GMT +1. The time now is 08:23 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 HardwareBanter.
The comments are property of their posters.