17 November 2008, 23:33 | #1 |
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. |
18 November 2008, 16:07 | #2 |
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.
|
18 November 2008, 17:03 | #3 |
Registered User
Join Date: Sep 2007
Location: Las Cruces, USA
Age: 71
Posts: 351
|
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"?
|
18 November 2008, 17:39 | #4 |
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 ?? |
18 November 2008, 18:35 | #5 | ||
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,535
|
Quote:
Quote:
|
||
18 November 2008, 22:48 | #6 |
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. |
18 November 2008, 23:40 | #7 |
Registered User
Join Date: Oct 2008
Location: EU
Posts: 163
|
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. |
19 November 2008, 08:14 | #8 |
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. |
19 November 2008, 16:36 | #9 | |
Registered User
Join Date: Sep 2007
Location: Las Cruces, USA
Age: 71
Posts: 351
|
Quote:
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? |
|
19 November 2008, 17:12 | #10 |
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". |
19 November 2008, 17:48 | #11 |
Registered User
Join Date: Oct 2008
Location: EU
Posts: 163
|
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 |
19 November 2008, 22:05 | #12 | |
Registered User
Join Date: Sep 2007
Location: Las Cruces, USA
Age: 71
Posts: 351
|
Quote:
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. |
|
19 November 2008, 23:22 | #13 |
Registered User
Join Date: Oct 2008
Location: EU
Posts: 163
|
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 |
20 November 2008, 00:16 | #14 | |
Registered User
Join Date: Sep 2007
Location: Las Cruces, USA
Age: 71
Posts: 351
|
Quote:
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. |
|
20 November 2008, 00:40 | #15 |
Registered User
Join Date: Oct 2008
Location: EU
Posts: 163
|
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. |
20 November 2008, 08:18 | #16 | ||
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,009
|
Quote:
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:
|
||
20 November 2008, 17:20 | #17 | |
Registered User
Join Date: Sep 2007
Location: Las Cruces, USA
Age: 71
Posts: 351
|
Quote:
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. |
|
20 November 2008, 17:33 | #18 | |
Registered User
Join Date: Sep 2007
Location: Las Cruces, USA
Age: 71
Posts: 351
|
Quote:
|
|
20 November 2008, 18:39 | #19 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,535
|
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 */ |
20 November 2008, 18:40 | #20 |
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. |
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 |
|
|