From owner-freebsd-current Wed Aug 15 2:15:29 2001 Delivered-To: freebsd-current@freebsd.org Received: from nasu.utsunomiya-u.ac.jp (nasu.utsunomiya-u.ac.jp [160.12.128.3]) by hub.freebsd.org (Postfix) with ESMTP id 3FAFE37B403 for ; Wed, 15 Aug 2001 02:15:17 -0700 (PDT) (envelope-from yokota@zodiac.mech.utsunomiya-u.ac.jp) Received: from nantai.utsunomiya-u.ac.jp by nasu.utsunomiya-u.ac.jp (8.11.2/1.1.29.3/26Jan01-1134AM) id f7F9F0c285399; Wed, 15 Aug 2001 18:15:00 +0900 (JST) Received: from zodiac.mech.utsunomiya-u.ac.jp by nantai.utsunomiya-u.ac.jp (8.11.2/1.1.29.3/30Jan01-0241PM) id f7F9F0K40422; Wed, 15 Aug 2001 18:15:00 +0900 (JST) Received: from zodiac.mech.utsunomiya-u.ac.jp (IDENT:GZfQHf7fGbULqStkFGlF80j/P/Wzv8+S@zodiac.mech.utsunomiya-u.ac.jp [160.12.43.7]) by zodiac.mech.utsunomiya-u.ac.jp (8.9.3+3.2W/3.7W/zodiac-May2000) with ESMTP id SAA06230; Wed, 15 Aug 2001 18:24:40 +0900 (JST) Message-Id: <200108150924.SAA06230@zodiac.mech.utsunomiya-u.ac.jp> To: freebsd-current@freebsd.org Cc: yokota@zodiac.mech.utsunomiya-u.ac.jp Subject: psmintr: out of sync (was: Re: FreeBSD's aggressive keyboard probe/attach) Date: Wed, 15 Aug 2001 18:24:39 +0900 From: Kazutaka YOKOTA Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Ok, I am back. There are so many issues to be explained and discussed. I will tackle them one by one.... - Flags 0x8000 for psm and "out-of-sync" error As many people want to make it default, and my initial intent to make it an option didn't work out well as a hindsight, we had better make it the standard, default feature. However, I would point out that THERE ARE CASES WHERE IT DOESN'T CORRECT "out-of-sync". The "out-of-sync" problem occurs in three situations. Case 1: there was communication error between the keyboard and the motherboard and data bytes from the mouse were somehow dropped. (I expect this is to be very rare these days.) Case 2: when you switch between more than two host computers connected to a KVM, there may be a loss of data bytes from the mouse to the FreeBSD box, if you try to switch computers during a packet is being sent from the mouse. This can be avoided if the KVM is intelligent enough to know the boundary of mouse data packets, but I suspect many KVMs on the market are not that smart; there are so many different mouse data format and packet length that I seriously doubt that KVMs know all of them and are able to ensure all data packets are sent to the host computers without splitting a data packet. Case 3: when you use a KVM, the mouse is initialized to one operating mode by a host computer, and then another computer tries to set up another operating mode of the mouse. Modern PS/2 mice have more than one operating mode to support wheels, additional buttons, and other extra features. These advanced modes most certainly use different packet data format and packet length than the original IBM PS/2 mouse (2 buttons, three-byte packet). If two computers try to put the mouse in different modes, they may be expecting different packet length, and will be confused when you switch between them. Even if the two computers are expecting the same packet length, you may witness wiered mouse pointer movement (instead of the "out of sync" message) because of the data format difference. If the KVM understands all the mouse operating modes from all venders and is able to set up the correct operaring mode for each computer when switching between them, we will have no problem. But, the KVMs we have today are not that capable for the same reason as I stated in the case 2 above. The flags 0x8000 can correct the first two situations and should get the mouse and the FreeBSD box back in sync. In case 3 above, this flag won't help; you will get a series of "out of sync" and "re-enable the mouse" messages. (I initially didn't like the idea that there would be a lot of traffic from the host computer to the mouse to disable/enable the mouse and we would still never get out of the error if we fell into this trap. That was another reason why I made the flag optional.) To get out of this error, we need to reset the mouse and reinitialize it the way we want. The trouble is that it is impossible for the psm driver to distinguish the above three situations. Reset and re-initialization is also effective for the case 1 and 2, but considered overkill and it will take a long time to do it. Another note on the "out-of-sync" error: we cannot guarantee that we can always detect it. Because there is no reliable way to find the start of the mouse data packet, the psm driver may operate without noticing the error and the mouse pointer goes berserk on your screen... Anyway, I am now considering the following experiment. - We make the psm driver count the number of the "out-of-sync" errors. - When the error is detected for the first time, the psm driver will throw few data bytes (up to entire packet size) and see if it can get back to sync. - If the error still persists, the psm driver disable/enable the mouse and see if it works. - If the error still persists and the count goes up to N (10 or 20?), the psm driver reset and reinitialize the mouse. The counter is reset to zero. Too complicated? Kazu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message