English Amiga Board


Go Back   English Amiga Board > Support > support.WinUAE

 
 
Thread Tools
Old 17 November 2008, 23:33   #1
Ed Cruse
Registered User
 
Join Date: Sep 2007
Location: Las Cruces, USA
Age: 71
Posts: 351
Problem with uaeserial.device

I’m trying to use uaeserial.device unit 10 to connect to com10 which is a virtual com port for my Blue Tooth connection to my robot. All I get is an instant error like uaeserial.device doesn’t exist. I’m able to connect to com10 with serial.device unit 0 by telling WinUAE to connect to com10 under Serial Port in the Game & IO Ports panel, and I am able to control the robot this way. Using uaeserial.device I’ve also tried connecting with a terminal program to com10, and also to com4 which is a real com port, but no joy. Yes, uaeserial.device is checked and shows up in my config as uaeserial=true. I’ve also done this in the past successfully, but it’s been a long time, probably before 1460 because it doesn’t work either.

I don’t think I’m doing anything stupid, but if I am it won’t be the first time. Thank you.
Attached Files
File Type: zip logs.zip (13.7 KB, 147 views)
Ed Cruse is offline  
Old 18 November 2008, 16:07   #2
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,535
run with -seriallog command line parameter and check the log again.
Toni Wilen is offline  
Old 18 November 2008, 17:03   #3
Ed Cruse
Registered User
 
Join Date: Sep 2007
Location: Las Cruces, USA
Age: 71
Posts: 351
Quote:
Originally Posted by Toni Wilen View Post
run with -seriallog command line parameter and check the log again.
I did and the log indicates there's no error. I tried to open while the log was open, I didn't see anything indicating a problem. Could the device name have gotten corrupted, I'm using "uaeserial.device"?
Attached Files
File Type: zip logs.zip (6.1 KB, 160 views)
Ed Cruse is offline  
Old 18 November 2008, 17:39   #4
amiga
Registered User
 
Join Date: Aug 2004
Location: Amiga_land
Posts: 443
@Toni:

I have a question:

What's the difference between selecting uaeserial.device in "game & i/o ports", and leaving it unselected ??
A better compatibility, maybe ??
amiga is offline  
Old 18 November 2008, 18:35   #5
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,535
Quote:
Originally Posted by Ed Cruse View Post
I did and the log indicates there's no error. I tried to open while the log was open, I didn't see anything indicating a problem. Could the device name have gotten corrupted, I'm using "uaeserial.device"?
Do you have uaeserial.device in exec device list? (use scout or artm to check it)

Quote:
What's the difference between selecting uaeserial.device in "game & i/o ports", and leaving it unselected ??
uaeserial.device = multi serial port "board". (com0 = unit 0, com1 = unit 1 etc..)
Toni Wilen is offline  
Old 18 November 2008, 22:48   #6
Ed Cruse
Registered User
 
Join Date: Sep 2007
Location: Las Cruces, USA
Age: 71
Posts: 351
[quote=Toni Wilen;478286]Do you have uaeserial.device in exec device list? (use scout or artm to check it) quote]

uaeserial.device does show up in the exec device list.

I went to the basics and opened to it with error=OpenDevice("uaeserial.device",10,&seriob,0);. It still errors, the error return is 0xffffff7c. I don't know what this means, according to the docs it's a sign extended copy of io_Error which is a signed byte, I couldn't find any definitions that made sense. Under the serial includes there's a series of definitions called SerErr_xxxxx but they're defined to 15 bits. If I change the name to serial.device and unit to 0 this works fine and returns a 0.
Ed Cruse is offline  
Old 18 November 2008, 23:40   #7
a4k-oerx
Registered User
 
Join Date: Oct 2008
Location: EU
Posts: 163
Question

Is your seriob initialized in some way? How big is it? Did you do something like that (pseudocode) before?

mp = CreatePort(0,0)
seriob = CreateStdIO(mp)


Just tried to find that in WinUAE 1.5.3 source (uaeserial.c), found a check:

259: static uae_u32 REGPARAM2 dev_open (TrapContext *context)

261: uaecptr ioreq = m68k_areg (&context->regs, 1);

267: if (get_word (ioreq + 0x12) < IOSTDREQ_SIZE)
268: return openfail (ioreq, IOERR_BADLENGTH);


Edit 3: IOERR_BADLENGTH is -4, maybe you get this?

I just unzipped the source for the first time some 15 mins ago and never read it before and my C experience is almost zero, so maybe I am completely wrong, but does the source assume that dev_open gets an IOStdReq here? Edit 2: Yes it assumes that, and it seems correct.

Edit: Don't trust me, wrote my last amiga-programs some 10 years ago..

Last edited by a4k-oerx; 19 November 2008 at 00:02.
a4k-oerx is offline  
Old 19 November 2008, 08:14   #8
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,535
Ok, error code explains it all. Size in iorequest field must be large enough (this is in NSD specs), basically your program is buggy

This check was added in some 1.4.x version.
Toni Wilen is offline  
Old 19 November 2008, 16:36   #9
Ed Cruse
Registered User
 
Join Date: Sep 2007
Location: Las Cruces, USA
Age: 71
Posts: 351
Quote:
Originally Posted by Toni Wilen View Post
Ok, error code explains it all. Size in iorequest field must be large enough (this is in NSD specs), basically your program is buggy

This check was added in some 1.4.x version.
What?

It's a IOExtSer and not a IOStdReg.

All I'm supposed to do is create an ioblock of the proper size and zero it, fill in io_SerFlags if I want shared and/or 7 wire hand shake, and then pass it to OpenDevice. The device fills in everything else.

The same code works with serial.device unit 0. Basically I don't know what you are talking about, what size? MNLength is the only thing I can see, but I don't have to fill that in.

Also, what is NSD?
Ed Cruse is offline  
Old 19 November 2008, 17:12   #10
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,535
From NSD ("NewStyleDevices") documentation:

Code:
Basic requirements
==================

Let's make a quick list about the most basic requirements for any new
style device. Keep it in mind when reading on.

    - IOERR_NOCMD support
    - no redefinition of standard V40 or reserved commands
    - no 3rd party commands in reserved areas
    - NSCMD_DEVICEQUERY is supported
    - lib_IdString must contain the name, version, and creation
      date of the device and any other readable information to make
      unique identification of a device for 3rd party command use
      possible.
    - Check mn_Length of the request on OpenDevice() for the minimum
      required length

Some devices may have additional requirements. These will be listed
in the sub document "NSD-DeviceSpecifics".
mn_length was always supposed to be filled with correct length but most devices didn't care about it. (and I won't remove it just because one or two random programs use zeroed mn_length)
Toni Wilen is offline  
Old 19 November 2008, 17:48   #11
a4k-oerx
Registered User
 
Join Date: Oct 2008
Location: EU
Posts: 163
Arrow

Quote:
Originally Posted by Ed Cruse View Post
It's a IOExtSer and not a IOStdReg.
Then you should use CreateExtIO(), did you try that? It should fill in the values as required (as far as I remember, would be interested if it really does).

There is an example for serial.device in Rom Kernel Reference Manual:
http://pub.elowar.com/AmigaDev/Devic.../node009D.html

Edit: And the corresponding closing procedure:
http://pub.elowar.com/AmigaDev/Devic.../node00A0.html

RKRM Online: English Amiga Board > » Misc > Coders Heaven
http://eab.abime.net/showthread.php?t=28085
a4k-oerx is offline  
Old 19 November 2008, 22:05   #12
Ed Cruse
Registered User
 
Join Date: Sep 2007
Location: Las Cruces, USA
Age: 71
Posts: 351
Quote:
Originally Posted by Toni Wilen View Post
From NSD ("NewStyleDevices") documentation:

Code:
 
Basic requirements
==================
 
Let's make a quick list about the most basic requirements for any new
style device. Keep it in mind when reading on.
 
    - IOERR_NOCMD support
    - no redefinition of standard V40 or reserved commands
    - no 3rd party commands in reserved areas
    - NSCMD_DEVICEQUERY is supported
    - lib_IdString must contain the name, version, and creation
      date of the device and any other readable information to make
      unique identification of a device for 3rd party command use
      possible.
   - Check mn_Length of the request on OpenDevice() for the minimum
     required length
 
Some devices may have additional requirements. These will be listed
in the sub document "NSD-DeviceSpecifics".
mn_length was always supposed to be filled with correct length but most devices didn't care about it. (and I won't remove it just because one or two random programs use zeroed mn_length)
I can't find anywhere in my books where the length was ever a requirement or even a suggestion, so I believe it's not right for anybody to make requirement changes like that.

The size field is like the priority and name fields, there book keeping fields used only when applicable, size is not applicable for devices. I believe the only functions that use size are the ones that create and delete ioblocks and messages.

If you really aren't going to take out the code then I highly suggest that you change the test so an IOExtSer request has to be passed, because if one passes a IOStdReq it will pass the test and still crash the computer, defeating the whole point of the test. Going by what it says in the serial includes I get the feeling that was a common problem.
Ed Cruse is offline  
Old 19 November 2008, 23:22   #13
a4k-oerx
Registered User
 
Join Date: Oct 2008
Location: EU
Posts: 163
Question

Can you answer my question if you used CreateExtIO() like in RKRM example to prepare the io request? Would like to know if that fills the fields as required.

Last edited by a4k-oerx; 19 November 2008 at 23:24. Reason: typo
a4k-oerx is offline  
Old 20 November 2008, 00:16   #14
Ed Cruse
Registered User
 
Join Date: Sep 2007
Location: Las Cruces, USA
Age: 71
Posts: 351
Quote:
Originally Posted by a4k-oerx View Post
Can you answer my question if you used CreateExtIO() like in RKRM example to prepare the io request? Would like to know if that fills the fields as required.
Sorry, it took me awhile to find CreateExtIO, it's in the Amiga linker library and according to the docs it does fill in the size field, it actually says that, but that's so DeleteExtIO will know how many bytes to deallocate. My problem has been I allocate my ioblocks myself and fill in the fields, I don't need the size field so I've never filled it in.

I filled in the size field with sizeof(struct IOExtSer) and now instead of a -4 I'm getting a -1 for an error return. Do you happen to know what that means from the source codes? Any help would be appreciated. This is really getting frustrating.
Ed Cruse is offline  
Old 20 November 2008, 00:40   #15
a4k-oerx
Registered User
 
Join Date: Oct 2008
Location: EU
Posts: 163
Lightbulb

Accoring to the above mentioned RKRM Online, -1 is IOERR_OPENFAIL

http://pub.elowar.com/AmigaDev/Inclu.../node008F.html

It is raised (in uaeserial.c) if either the maximum of allowed open devices is reached,

26: #define MAX_TOTAL_DEVICES 8

277: if (i == MAX_TOTAL_DEVICES)
278: return openfail (ioreq, IOERR_OPENFAIL);


or if internal function uaeser_open() (located in od-win32\parser.c, line 694) fails,

281: if (!uaeser_open (dev->sysdata, dev, unit)) {
..
283: return openfail (ioreq, IOERR_OPENFAIL);


with the uaeser_open() function on win32 side
a) can not CreateEvent (without log-entry) or
b) can not CreateFile() with the COMx port (with a "UAESER: .." msg in log)

or in case of an error in setparams() (with a "UAESER: .." msg in log),

291: err = setparams (dev, ioreq);
..
296: return openfail (ioreq, err);


are any entries in your log?

Edit: The WinUAE source code is available at http://www.winuae.net/ on download-page.

Last edited by a4k-oerx; 20 November 2008 at 08:44.
a4k-oerx is offline  
Old 20 November 2008, 08:18   #16
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 7,009
Quote:
Sorry, it took me awhile to find CreateExtIO, it's in the Amiga linker library
Since Kickstart 2.0 there are CreateIORequest/DeleteIORequest in exec.library as well as CreateMsgPort/DeleteMsgPort.

If you are still reading the 1.3 RKRMs you should start to read 2.0 RKRMs now. They are contained in AmigaGuide format on the Amiga Developer CD which is essential for development anyway.

Quote:
I'm getting a -1 for an error return. Do you happen to know what that means from the source codes?
Why don't you look it up youself ? General error codes (negative values) are listed in exec/errors.h, device-specific errors (positive values) are listed in devices/#?.h.
thomas is offline  
Old 20 November 2008, 17:20   #17
Ed Cruse
Registered User
 
Join Date: Sep 2007
Location: Las Cruces, USA
Age: 71
Posts: 351
Quote:
Originally Posted by thomas View Post
Since Kickstart 2.0 there are CreateIORequest/DeleteIORequest in exec.library as well as CreateMsgPort/DeleteMsgPort.

If you are still reading the 1.3 RKRMs you should start to read 2.0 RKRMs now. They are contained in AmigaGuide format on the Amiga Developer CD which is essential for development anyway.



Why don't you look it up youself ? General error codes (negative values) are listed in exec/errors.h, device-specific errors (positive values) are listed in devices/#?.h.
I've been reading the 2.0 RKRMs, I never looked at exec/errors.h, I was looking for that information in exec/devices.h because that seemed reasonable. Since OpenDevice is an exec call it makes sense where the info is. Thanks

At this point I don't know what I'm doing wrong, I used CreateIORequest(replyport,sizeof(struct IOExtSer)); and I still get a -1 return. The same code works with serial.device. If I change the size argument to one less then IOStdReq then I get a return of -4, which is returned from the device, so OpenDevice() is finding uaeserial.device, which means the device itself is creating the -1. OpenDevice also returns a -1 if it can't find a device.

According to the chapter on serial.device, unless the flags for Shared or 7-Wire are needed there's nothing else to set. I know com10 (virtual Blue Tooth comport) works because I can have WinUAE redirect serial.device to it and open to serial.device and it works. I can then control my robot. Plus the robot control program did work about a year or so ago, and I haven't touch it since.

I'm at a loss, the only thing left is there's a bug in uaeserial.device, unless anybody has an idea of what I'm doing wrong.
Ed Cruse is offline  
Old 20 November 2008, 17:33   #18
Ed Cruse
Registered User
 
Join Date: Sep 2007
Location: Las Cruces, USA
Age: 71
Posts: 351
Quote:
Originally Posted by a4k-oerx View Post
Accoring to the above mentioned RKRM Online, -1 is IOERR_OPENFAIL

http://pub.elowar.com/AmigaDev/Inclu.../node008F.html

It is raised (in uaeserial.c) if either the maximum of allowed open devices is reached,

26: #define MAX_TOTAL_DEVICES 8

277: if (i == MAX_TOTAL_DEVICES)
278: return openfail (ioreq, IOERR_OPENFAIL);

or if internal function uaeser_open() (located in od-win32\parser.c, line 694) fails,

281: if (!uaeser_open (dev->sysdata, dev, unit)) {
..
283: return openfail (ioreq, IOERR_OPENFAIL);

with the uaeser_open() function on win32 side
a) can not CreateEvent (without log-entry) or
b) can not CreateFile() with the COMx port (with a "UAESER: .." msg in log)

or in case of an error in setparams() (with a "UAESER: .." msg in log),

291: err = setparams (dev, ioreq);
..
296: return openfail (ioreq, err);

are any entries in your log?

Edit: The WinUAE source code is available at http://www.winuae.net/ on download-page.
The log shows err=2 for uaeserial.
Attached Files
File Type: zip logs.zip (6.1 KB, 172 views)
Ed Cruse is offline  
Old 20 November 2008, 18:39   #19
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,535
Quote:
Originally Posted by Ed Cruse View Post
The log shows err=2 for uaeserial.
2 is Windows error code.

// MessageId: ERROR_FILE_NOT_FOUND
//
// MessageText:
//
// The system cannot find the file specified.
//
#define ERROR_FILE_NOT_FOUND 2L

(do you really have COM10?)

OpenDevice() -1:

#define IOERR_OPENFAIL (-1) /* device/unit failed to open */
Toni Wilen is offline  
Old 20 November 2008, 18:40   #20
a4k-oerx
Registered User
 
Join Date: Oct 2008
Location: EU
Posts: 163
@Ed Cruse, Toni, please check your PM http://eab.abime.net/private.php

Last edited by a4k-oerx; 20 November 2008 at 18:49.
a4k-oerx is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
audio device in use problem Hungry Horace project.WHDLoad 14 28 January 2019 11:41
uaenet.device problem with amitcp 2.2 Leandro Jardim support.WinUAE 15 06 August 2012 10:00
problem when trying to use ADF Device pulselooper support.Apps 4 14 July 2010 19:44
uaescsi.device problem Solid Snake support.WinUAE 7 23 October 2008 19:23
uaeserial.device ppill support.WinUAE 7 25 April 2007 09:12

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 On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 02:06.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.11213 seconds with 14 queries