Home > Archive > Cobol > March 2004 > Read/Write USB with MFC NE 3.1?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Read/Write USB with MFC NE 3.1?
|
|
| Paul H 2004-03-26, 10:59 pm |
| Where can I read about doing I/O on one of the USB ports of my PC? (using
Micro Focus COBOL Net Express 3.1)
Thanks,
Paul
| |
| Richard 2004-03-26, 10:59 pm |
| "Paul H" <NospaMphobergNospaM@att.net> wrote
> Where can I read about doing I/O on one of the USB ports of my PC? (using
> Micro Focus COBOL Net Express 3.1)
If it is a USB memory card then it may appear to the system as a disk
drive which can be read and written simply by using an appropriate
file name.
If it is something else then why do you want to write a device driver
in Cobol ?
| |
| Thane Hubbell 2004-03-26, 10:59 pm |
| I'm curious as to what you want to do to the USB port. Mostly devices
have drivers that obscure this level and you don't care. I think I
may know how to do this but I'm interested in a little more
information first.
"Paul H" <NospaMphobergNospaM@att.net> wrote in message news:<6Ua3c.148777$Xp.602126@attbi_s54>...
> Where can I read about doing I/O on one of the USB ports of my PC? (using
> Micro Focus COBOL Net Express 3.1)
> Thanks,
> Paul
| |
| Paul H 2004-03-26, 10:59 pm |
| I want to use the USB cable to my cell phone to upload and download names,
phone numbers, and whatever else is accessible using "AT" commands. Years
ago when I needed to access serial ports to talk to modems, from MF Cobol, I
had to write an assembly language routine to deal with the port. I hope
things have improved since then.
Thanks,
Paul
"Thane Hubbell" <thaneh@softwaresimple.com> wrote in message
news:bfdfc3e8.0403082250.15fbfbbd@posting.google.com...
I'm curious as to what you want to do to the USB port. Mostly devices
have drivers that obscure this level and you don't care. I think I
may know how to do this but I'm interested in a little more
information first.
"Paul H" <NospaMphobergNospaM@att.net> wrote in message
news:<6Ua3c.148777$Xp.602126@attbi_s54>...
> Where can I read about doing I/O on one of the USB ports of my PC? (using
> Micro Focus COBOL Net Express 3.1)
> Thanks,
> Paul
| |
| Howard Brazee 2004-03-26, 10:59 pm |
| This is a job for the operating system. The application shouldn't need to know
that type of detail about where it is writing to. The application should just
write to a file on a drive.
That works when I write to my USB memory card. Some old operating systems
have trouble with it though and I have to make sure that the card is mounted
before I boot up. But newer operating systems handle this seamlessly.
| |
| Paul H 2004-03-26, 10:59 pm |
| Hi Howard,
That sounds good to me. How should I refer to it in my COBOL program? I
find no reference to "USB" in my manuals. Most of my computers have more
than one USB and serial ports.
Thanks,
Paul
"Howard Brazee" <howard@brazee.net> wrote in message
news:c2kmct$45o$1@peabody.colorado.edu...
This is a job for the operating system. The application shouldn't need to
know
that type of detail about where it is writing to. The application should
just
write to a file on a drive.
That works when I write to my USB memory card. Some old operating systems
have trouble with it though and I have to make sure that the card is mounted
before I boot up. But newer operating systems handle this seamlessly.
| |
| Howard Brazee 2004-03-26, 10:59 pm |
|
On 9-Mar-2004, "Paul H" <NospaMphobergNospaM@att.net> wrote:
> That sounds good to me. How should I refer to it in my COBOL program? I
> find no reference to "USB" in my manuals. Most of my computers have more
> than one USB and serial ports.
The USB memory card is just another drive. How do you refer to it from your
OS? On my Windows machine I call my memory card by a drive letter.
I plugged in my memory card to my card reader at work and noted that it created
a drive I:. I was able to drag files to I:, and take that memory card home
and read it there (the drive letter at home was different).
So I created a batch file to automate copying files to my memory card. The
first part of it is at the end of its post. The only thing special in it is a
check to make sure that the drive is plugged in.
Plug in your card. See what drive letter it is. Drag a file to it. Read
that file.
Now write your CoBOL program. Open the file by drive letter and name. Do
status checking to make sure that the I/O worked correctly. CoBOL doesn't care
what medium it is on. (It is DASD - but beyond that you don't care).
..BAT code segment follows
rem backstick.bat rem %userprofile% = "C:\Documents and
Settings\brazee"
DIR I: 2>NUL | FIND /I "DIR" >NUL
@If ErrorLevel 1 echo "no Drive I: found"
@If not ErrorLevel 1 echo "drive I: found"
@If ErrorLevel 1 goto :Finale
:Continue
erase "c:\floppy\bookmark.htm" < C:\Belfry\y
erase "c:\floppy\bookmarks.html" < C:\Belfry\y
erase "C:\floppy\opera*.adr" < C:\Belfry\y
erase "C:\floppy\*.bak" < C:\Belfry\y
erase "C:\floppy\bookmarks.mozilla" < C:\Belfry\y
erase "C:\floppy\firebird\*.*" < C:\Belfry\y
erase "C:\floppy\opera\*.*" < C:\Belfry\y
xcopy "%USERPROFILE%\brazee\mphshb0w.slt\bookmarks.html"
"c:\floppy\firebird\*.*" /K/Q
xcopy "%USERPROFILE%\Application Data\MailwasherPro\*.*"
"c:\floppy\MailwasherPro\*.*" /K/Q < c:\belfry\a
Xcopy "C:\Documents and Settings\brazee\Application
Data\Opera\Opera\profile\*.*" C:\floppy\opera\*.* /K /Q < c:\belfry\a
....
| |
| Thane Hubbell 2004-03-26, 10:59 pm |
| I think Windows API calls are the way to go here. Suggest you search
MSDN.COM for "serial communications".
"Paul H" <NospaMphobergNospaM@att.net> wrote in message news:<GZf3c.155766$Xp.627934@attbi_s54>...[color=darkred]
> I want to use the USB cable to my cell phone to upload and download names,
> phone numbers, and whatever else is accessible using "AT" commands. Years
> ago when I needed to access serial ports to talk to modems, from MF Cobol, I
> had to write an assembly language routine to deal with the port. I hope
> things have improved since then.
> Thanks,
> Paul
>
> "Thane Hubbell" <thaneh@softwaresimple.com> wrote in message
> news:bfdfc3e8.0403082250.15fbfbbd@posting.google.com...
> I'm curious as to what you want to do to the USB port. Mostly devices
> have drivers that obscure this level and you don't care. I think I
> may know how to do this but I'm interested in a little more
> information first.
>
> "Paul H" <NospaMphobergNospaM@att.net> wrote in message
> news:<6Ua3c.148777$Xp.602126@attbi_s54>...
| |
| Paul H 2004-03-26, 10:59 pm |
| Sorry to miss-lead you, Howard. I will be using a USB cable to connect to a
cell phone, not to a memory device. I want to read and write names, phone
numbers, and any other accessible data in the phone. While, when I plus a
digital phone memory card reader into a USB port, it immediately shows as a
memory device, when I plug the phone in, it is ignored. If I could access
it as any file type - byte-stream or whatever, that would be terrific. But
I don't see how. I believe I need to be able to do my own I/O to that port.
Send my own command strings to the phone and read replies. Any help would
be appreciated. Maybe I can buy a driver from someone?
Thanks,
Paul
"Howard Brazee" <howard@brazee.net> wrote in message
news:c2ksp6$bqr$1@peabody.colorado.edu...
On 9-Mar-2004, "Paul H" <NospaMphobergNospaM@att.net> wrote:
> That sounds good to me. How should I refer to it in my COBOL program? I
> find no reference to "USB" in my manuals. Most of my computers have more
> than one USB and serial ports.
The USB memory card is just another drive. How do you refer to it from
your
OS? On my Windows machine I call my memory card by a drive letter.
I plugged in my memory card to my card reader at work and noted that it
created
a drive I:. I was able to drag files to I:, and take that memory card
home
and read it there (the drive letter at home was different).
So I created a batch file to automate copying files to my memory card.
The
first part of it is at the end of its post. The only thing special in it
is a
check to make sure that the drive is plugged in.
Plug in your card. See what drive letter it is. Drag a file to it.
Read
that file.
Now write your CoBOL program. Open the file by drive letter and name. Do
status checking to make sure that the I/O worked correctly. CoBOL doesn't
care
what medium it is on. (It is DASD - but beyond that you don't care).
..BAT code segment follows
rem backstick.bat rem %userprofile% = "C:\Documents and
Settings\brazee"
DIR I: 2>NUL | FIND /I "DIR" >NUL
@If ErrorLevel 1 echo "no Drive I: found"
@If not ErrorLevel 1 echo "drive I: found"
@If ErrorLevel 1 goto :Finale
:Continue
erase "c:\floppy\bookmark.htm" < C:\Belfry\y
erase "c:\floppy\bookmarks.html" < C:\Belfry\y
erase "C:\floppy\opera*.adr" < C:\Belfry\y
erase "C:\floppy\*.bak" < C:\Belfry\y
erase "C:\floppy\bookmarks.mozilla" < C:\Belfry\y
erase "C:\floppy\firebird\*.*" < C:\Belfry\y
erase "C:\floppy\opera\*.*" < C:\Belfry\y
xcopy "%USERPROFILE%\brazee\mphshb0w.slt\bookmarks.html"
"c:\floppy\firebird\*.*" /K/Q
xcopy "%USERPROFILE%\Application Data\MailwasherPro\*.*"
"c:\floppy\MailwasherPro\*.*" /K/Q < c:\belfry\a
Xcopy "C:\Documents and Settings\brazee\Application
Data\Opera\Opera\profile\*.*" C:\floppy\opera\*.* /K /Q < c:\belfry\a
....
| |
| Donald Tees 2004-03-26, 10:59 pm |
| Paul H wrote:
> Sorry to miss-lead you, Howard. I will be using a USB cable to connect to a
> cell phone, not to a memory device. I want to read and write names, phone
> numbers, and any other accessible data in the phone. While, when I plus a
> digital phone memory card reader into a USB port, it immediately shows as a
> memory device, when I plug the phone in, it is ignored. If I could access
> it as any file type - byte-stream or whatever, that would be terrific. But
> I don't see how. I believe I need to be able to do my own I/O to that port.
> Send my own command strings to the phone and read replies. Any help would
> be appreciated. Maybe I can buy a driver from someone?
> Thanks,
> Paul
>
MarshalSoft have drivers, or you can use the API as Thane suggested.
Donald
| |
| Joe Zitzelberger 2004-03-26, 10:59 pm |
| In article <7Pv3c.531045$na.1304652@attbi_s04>,
"Paul H" <NospaMphobergNospaM@att.net> wrote:
> Sorry to miss-lead you, Howard. I will be using a USB cable to connect to a
> cell phone, not to a memory device. I want to read and write names, phone
> numbers, and any other accessible data in the phone. While, when I plus a
> digital phone memory card reader into a USB port, it immediately shows as a
> memory device, when I plug the phone in, it is ignored. If I could access
> it as any file type - byte-stream or whatever, that would be terrific. But
> I don't see how. I believe I need to be able to do my own I/O to that port.
> Send my own command strings to the phone and read replies. Any help would
> be appreciated. Maybe I can buy a driver from someone?
> Thanks,
> Paul
It is very likely that you will NOT need to cope with raw USB I/O to do
this. The USB driver part should be managed by your OS and it should
provide an interface to let you treat any USB attached device as a
character or block device.
Which OS are you using?
Does the phones manufacturer offer an SDK?
| |
| Paul H 2004-03-26, 10:59 pm |
| Joe,
I'm using WINXP HE. nokia provides free SDKs, but I am having difficulty
finding one that will do the simple things I want to do. Theirs deal with
games, pictures, applications, et. I want to deal with subscriber
accessible data, maybe provisioning info. motorola wants $10k for theirs,
plus a per phone fee. Audiovox and Samsung ignore my request for info.
about theirs. I would prefer to do it myself, but I will do whatever works.
I have not had any success finding any API as others have suggested. I
agree with you that the OS should let me deal with it as a character or
block device. But how? And how to specify it to MF COBOL?
Thanks,
Paul
"Joe Zitzelberger" <joe_zitzelberger@nospam.com> wrote in message
news:joe_zitzelberger-1BD965.08173510032004@corp.supernews.com...
In article <7Pv3c.531045$na.1304652@attbi_s04>,
"Paul H" <NospaMphobergNospaM@att.net> wrote:
> Sorry to miss-lead you, Howard. I will be using a USB cable to connect to
a
> cell phone, not to a memory device. I want to read and write names, phone
> numbers, and any other accessible data in the phone. While, when I plus a
> digital phone memory card reader into a USB port, it immediately shows as
a
> memory device, when I plug the phone in, it is ignored. If I could access
> it as any file type - byte-stream or whatever, that would be terrific.
But
> I don't see how. I believe I need to be able to do my own I/O to that
port.
> Send my own command strings to the phone and read replies. Any help would
> be appreciated. Maybe I can buy a driver from someone?
> Thanks,
> Paul
It is very likely that you will NOT need to cope with raw USB I/O to do
this. The USB driver part should be managed by your OS and it should
provide an interface to let you treat any USB attached device as a
character or block device.
Which OS are you using?
Does the phones manufacturer offer an SDK?
| |
| Donald Tees 2004-03-26, 10:59 pm |
| Paul H wrote:
> Joe,
> I'm using WINXP HE. nokia provides free SDKs, but I am having difficulty
> finding one that will do the simple things I want to do. Theirs deal with
> games, pictures, applications, et. I want to deal with subscriber
> accessible data, maybe provisioning info. motorola wants $10k for theirs,
> plus a per phone fee. Audiovox and Samsung ignore my request for info.
> about theirs. I would prefer to do it myself, but I will do whatever works.
> I have not had any success finding any API as others have suggested. I
> agree with you that the OS should let me deal with it as a character or
> block device. But how? And how to specify it to MF COBOL?
> Thanks,
> Paul
I have example code that uses the Marshalsoft routines to read barcode
readers and serial weigh scales if you like. It is fairly low level,
but includes routines to set baud rates, read, write, etc. The stuff was
written several years back (tests under winXX and XP) and really should
be replaced with API calls per Thanes suggestion, but ...
Donald
| |
| Richard 2004-03-26, 10:59 pm |
| "Paul H" <NospaMphobergNospaM@att.net> wrote
> Sorry to miss-lead you, Howard. I will be using a USB cable to connect to a
> cell phone, not to a memory device. I want to read and write names, phone
> numbers, and any other accessible data in the phone. While, when I plus a
> digital phone memory card reader into a USB port, it immediately shows as a
> memory device, when I plug the phone in, it is ignored. If I could access
> it as any file type - byte-stream or whatever, that would be terrific. But
> I don't see how. I believe I need to be able to do my own I/O to that port.
> Send my own command strings to the phone and read replies. Any help would
> be appreciated. Maybe I can buy a driver from someone?
If the phone does not show up as a memory device and/or a virtual disk
drive, (as many USB devices do) then you first need to find out from
the phone manufactuturer just what it does 'look' like. What protocol
to use, what drivers are available, what utilities will run. If it
has a USB connector then there must be some reason for it and some use
for it. I would have thought that there was some software supplied
that synchronised the phone with computer files, or saved and reloaded
the phone data.
If there are utility systems you then only need to manipulate the
computer data files and synchronise back into the phone.
If you need to actually bit-bang onto the phone itself you are asking
the wrong people, you should be asking the phone company. Of course
they won't give the details in Cobol source, but if you get C code you
should be able to call it or convert it easily enough.
|
|
|
|
|