@@ -499,39 +499,45 @@ Interface* StgDriver::LookupDevice( player_devaddr_t addr )
499
499
// subscribe to a device
500
500
int StgDriver::Subscribe (QueuePointer &queue,player_devaddr_t addr)
501
501
{
502
+ printf (" StgDriver::Subscribe\n " );
502
503
if ( addr.interf == PLAYER_SIMULATION_CODE )
503
- return 0 ; // ok
504
+ {
505
+ printf (" StgDriver::Subscribe: Something's subscribing to the simulation\n " );
506
+ return 1 ; // ok
507
+ }
504
508
505
509
Interface* device = this ->LookupDevice ( addr );
506
510
507
511
if ( device )
508
512
{
509
- device->Subscribe ();
513
+ device->Subscribe ();
510
514
device->Subscribe (queue);
511
- return Driver::Subscribe (addr);
515
+ puts (" Found device" );
516
+ int result = this ->Driver ::Subscribe (addr);
517
+ return result;
512
518
}
513
519
514
520
puts ( " failed to find a device" );
515
- return 1 ; // error
521
+ return - 1 ; // error
516
522
}
517
523
518
524
519
525
// unsubscribe to a device
520
526
int StgDriver::Unsubscribe (QueuePointer &queue,player_devaddr_t addr)
521
527
{
522
528
if ( addr.interf == PLAYER_SIMULATION_CODE )
523
- return 0 ; // ok
529
+ return 1 ; // ok
524
530
525
531
Interface* device = this ->LookupDevice ( addr );
526
532
527
533
if ( device )
528
534
{
529
- device->Unsubscribe ();
535
+ device->Unsubscribe ();
530
536
device->Unsubscribe (queue);
531
537
return Driver::Unsubscribe (addr);
532
538
}
533
539
else
534
- return 1 ; // error
540
+ return - 1 ; // error
535
541
}
536
542
537
543
StgDriver::~StgDriver ()
@@ -565,6 +571,7 @@ StgDriver::ProcessMessage(QueuePointer &resp_queue,
565
571
player_msghdr * hdr,
566
572
void * data)
567
573
{
574
+ printf (" StgDriver::ProcessMessage\n " );
568
575
// find the right interface to handle this config
569
576
Interface* in = this ->LookupDevice ( hdr->addr );
570
577
if ( in )
@@ -583,8 +590,8 @@ StgDriver::ProcessMessage(QueuePointer &resp_queue,
583
590
584
591
void StgDriver::Update (void )
585
592
{
586
- Driver::ProcessMessages ( );
587
-
593
+ // printf("StgDriver::Update\n" );
594
+ ProcessMessages ();
588
595
FOR_EACH ( it, this ->devices )
589
596
{
590
597
Interface* interface = *it;
@@ -619,5 +626,15 @@ void StgDriver::Update(void)
619
626
}
620
627
}
621
628
}
622
-
629
+ /*
630
+ void StgDriver::Main(void)
631
+ {
632
+ for(;;)
633
+ {
634
+ pthread_testcancel();
635
+ ProcessMessages();
636
+ this->UpdateDrivers();
637
+ }
638
+ }
639
+ */
623
640
0 commit comments