On Thu, 6 Feb 2003 [EMAIL PROTECTED] wrote: > > One issue that comes up with this fix, is that in general the most you have > to type home to invoke it as an AID key should be twice. > 1. -->to the home position if it's not already there. > 2. -->AID key. > Somehow, with this fix, you have to end up pressing it 3 times. This might > be because the check to see if Home should be processed as an aid key is > done at the end of tn5250_display_kf_home. >
This issue does not appear to be your patch's fault :) If you run a trace file, and watch it with tail -f, you'll see that on the 2nd press of the HOME key, tn5250 does in fact send an AID record. The AS/400 sends back a screen that has an IC order that goes to x'01', x'08' (the start of the COMMAND line in SEU). However, TN5250 is not positioning the cursor to this position. The reason for this appears to be that x_system is off... it only wants to move the cursor to the IC when the keyboard transitions from x_system to unlocked. I believe that this is incorrect behavior. There's a comment in the 5494 functions reference manual about bit 1 of the 2nd control byte which I believe was taken out of context. This bit was not even being checked :) I have a fix that may be correct. I say "may be" because I'm not quite sure what else it breaks :) I also wonder what is supposed to happen for a 2nd WTD command... I know that if an IC or MC order is sent, we are to use it. But, what if no IC or MC is sent? Do we use the one from the last WTD, or do we reset back to 0,0? That's the one thing that I can figure would be affected by not resetting pending_insert to 0. If the new format has no IC order, the pending_insert=1 may still be around from the last WTD, causing the cursor to get reset to that same position (again). But, maybe it shouldn't? I'll take a look at that when I get a chance. Please try this patch. I think it's correct... if not, please let me know... Index: display.c =================================================================== RCS file: /cvsroot/tn5250/tn5250/src/display.c,v retrieving revision 1.49 diff -u -r1.49 display.c --- display.c 4 Nov 2002 08:55:56 -0000 1.49 +++ display.c 7 Feb 2003 00:52:00 -0000 @@ -541,7 +541,7 @@ { if (This->pending_insert) { tn5250_dbuffer_goto_ic(This->display_buffers); - This->pending_insert = 0; + /* This->pending_insert = 0; */ } else { int y = 0, x = 0; Tn5250Field *iter = This->display_buffers->field_list; Index: session.c =================================================================== RCS file: /cvsroot/tn5250/tn5250/src/session.c,v retrieving revision 1.59 diff -u -r1.59 session.c --- session.c 4 Nov 2002 08:55:56 -0000 1.59 +++ session.c 7 Feb 2003 00:52:00 -0000 @@ -850,9 +850,10 @@ is_x_system = (This->display->keystate != TN5250_KEYSTATE_UNLOCKED); will_be_unlocked = ((CC2 & TN5250_SESSION_CTL_UNLOCK) != 0); cur_opcode = tn5250_record_opcode(This->record); - if (end_y != 0xff && end_x != 0xff) + if (end_y != 0xff && end_x != 0xff && !(CC2 & TN5250_SESSION_CTL_IC_ULOCK)) { tn5250_display_set_cursor(This->display, end_y, end_x); - else if((is_x_system && will_be_unlocked) || + } + else if((will_be_unlocked && !(CC2 & TN5250_SESSION_CTL_IC_ULOCK)) || cur_opcode == TN5250_RECORD_OPCODE_RESTORE_SCR) { tn5250_display_set_cursor_home (This->display); } else { _______________________________________________ This is the Linux 5250 Development Project (LINUX5250) mailing list To post a message email: [EMAIL PROTECTED] To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/linux5250 or email: [EMAIL PROTECTED] Before posting, please take a moment to review the archives at http://archive.midrange.com/linux5250.