select bug?

Jan Derfinak ja na mail.upjs.sk
Pondělí Září 27 10:18:11 CEST 1999


On 26 Sep 1999, Stanislav Meduna wrote:

> On 25 Sep 1999 16:06:19 GMT, Mikulas Patocka wrote:
> 
> : Chovani funkce select na pipy v linuxu mi prijde podivne.


Uvediem tu mail, ktory som uz davnejsie pisal do konferecie o
gnokii. (jeho slovensku podobu) 

----------
Mam podozrenie, ze na mojom notebooku nefunguje fnc select na IR porte
korektne. Konkretne snazil som sa dosiahnut aby xgnokii fungovala
"off-line". To znamena aj vtedy ak nie je telefon pripojeny (Tak ako to ide
v NCDS). Pritom som zistil, thread FB61_ThreadLoop zostava zablovany vo
funkcii FB61_InitIR115200:

bool FB61_InitIR115200(void)
{
  u8 connect_seq[] = {FB61_FRAME_HEADER, 0x0d, 0x00, 0x00, 0x02};

  bool ret         = true;
  u8 nr_read       = 0;
  u8 in_buffer[255];
  struct timeval timeout;
  fd_set ready;
  int no_timeout   = 0;
  int i;
  int done         = 0;

  /* send the connection sequence to phone */
  FB61_TX_SendMessage(7, 0x02, connect_seq);

  /* Wait for 1 sec. */
  timeout.tv_sec  = 1;
  timeout.tv_usec = 0;

  do {
    FD_ZERO(&ready);
    FD_SET(PortFD, &ready);
    no_timeout = select(PortFD + 1, &ready, NULL, NULL, &timeout);

#ifdef DEBUG
      printf ("Timeout in IR-mode: %d\n", no_timeout);
#endif DEBUG

    if ( FD_ISSET(PortFD, &ready) ) {
      nr_read = read(PortFD, in_buffer, 1);
/* Tu sa program zablokuje. select vrati 1, ale telefon nie je pripojeny,
   takze sa z portu nemoze nic precitat.
*/

#ifdef DEBUG
      printf("Tu by som chcel byt.\n");
#endif
      if ( nr_read >= 1 ) {
        for (i=0; i < nr_read; i++) {
          if ( in_buffer[i] == FB61_IR_FRAME_ID ) {
            done = 1;
            ret = true;
            break;
          }
        }
      } else {
...

Tu su debug vypisy:
bez IR spojenia:
[ja na flyingAngel gnokii-0.3.0-pre11]# ./xgnokii
Starting IR mode...!
PC: 1c:00:0c:02:00:09:00:01:00:0d:00:00:02:01:40:00:52:06:
Timeout in IR-mode: 1
PC: 1c:00:0c:04:00:06:00:01:00:01:01:41:11:43:
PC: 1c:00:0c:04:00:06:00:01:00:01:01:42:11:40:
PC: 1c:00:0c:04:00:06:00:01:00:01:01:43:11:41:
PC: 1c:00:0c:11:00:06:00:01:00:6d:01:44:11:3f:
PC: 1c:00:0c:14:00:07:00:01:00:36:64:01:45:00:31:25:
PC: 1c:00:0c:04:00:06:00:01:00:01:01:46:11:44:
PC: 1c:00:0c:04:00:06:00:01:00:01:01:47:11:45:
PC: 1c:00:0c:04:00:06:00:01:00:01:01:40:11:42:
PC: 1c:00:0c:11:00:06:00:01:00:6d:01:41:11:3a:
PC: 1c:00:0c:14:00:07:00:01:00:36:64:01:42:00:36:25:

s IR spojenim:
[ja na flyingAngel gnokii-0.3.0-pre11]# ./xgnokii
Starting IR mode...!
PC: 1c:00:0c:02:00:09:00:01:00:0d:00:00:02:01:40:00:52:06:
Timeout in IR-mode: 1
Tu by som chcel byt.
[Sending Ack of type 02, seq: 1]
Msg Dest: PC
Msg Source: Phone
Msg Type: 02
Msg Unknown: 00
Msg Len: 06
Phone: [01 ][08 ][00 ][0e ][01 ][41A][1c ][4fO]

pokusne som nadefinoval ako IR port normalny seriovy port (Ale typ spojenia
som nechal infrared):
[ja na flyingAngel gnokii-0.3.0-pre11]# ./xgnokii
Starting IR mode...!
PC: 1c:00:0c:02:00:09:00:01:00:0d:00:00:02:01:40:00:52:06:
Timeout in IR-mode: 0   <-- Toto by mal vratit select aj na IR porte.
Timeout in IR-mode
PC: 1c:00:0c:02:00:09:00:01:00:0d:00:00:02:01:41:00:53:06:
PC: 1c:00:0c:04:00:06:00:01:00:01:01:42:11:40:
Timeout in IR-mode: 0
Timeout in IR-mode
PC: 1c:00:0c:02:00:09:00:01:00:0d:00:00:02:01:43:00:51:06:
PC: 1c:00:0c:04:00:06:00:01:00:01:01:44:11:46:



Notebook je compaq Armada 1575D. Porty su detekovane takto:
Serial driver version 4.27 with no serial options enabled
ttyS00 at 0x03f8 (irq = 4) is a 16550A  << seriovy port
ttyS02 at 0x03e8 (irq = 4) is a 16550A  << IR port

					jano

-- 
When you're strange
Faces come out of the rain
When you're strange
No one remembers your name
			The Doors-People Are Strange



Další informace o konferenci Linux