Example #1
0
int
main( int argc, char *argv[] )
{
  if ( argc > 2 )
       return usage( argv[0] );

  const char *config_name = "lan_local";

  if ( argc == 2 )
       config_name = argv[1];

  const char **config = FindConfig( config_name );

  if ( config == 0 )
       return usage( argv[0] );

  void *dummy;
  struct oh_abi_v2 *abi = 0;
  GHashTable *params;
  void *hdl;
  uuid_t myuid;

  oh_uid_initialize();

  memcpy( &myuid, UUID_OH_ABI_V2, sizeof(myuid) );

  if (    ipmidirect_get_interface( &dummy, myuid ) < 0
       || dummy == 0 )
     {
       printf( "cannot get interface !\n" );
       return 10;
     }

  abi = (struct oh_abi_v2 *) dummy;

  if ( abi->open == 0 )
     {
       printf( "cannot get interface !\n" );
       return 10;
     }
	  
  params = AllocParams( config );

  hdl = abi->open( params );

  if ( hdl == 0 )
     {
       printf( "cannot open plugin !\n" );
       return 10;
     }

  printf( "ready.\n" );
  TestInterface( abi, hdl );

  abi->close( hdl );
  DestryParams( params );

  return 0;
}
Example #2
0
File: main.cpp Project: jmfb/Com
int main()
{
	TestLong();
	TestString();
	TestWideString();
	TestBool();
	TestDate();
	TestVariant();
	TestInterface();
	TestSmartPointer();
	TestError();
	return 0;
}
bool TestInterfaces() {
  // Enumerate interfaces
  ADBAPIHANDLE enum_handle =
    AdbEnumInterfaces(kAdbInterfaceId, true, true, true);
  if (NULL == enum_handle) {
    printf("\nTest interfaces failure:");
    printf("\nUnable to enumerate ADB interfaces: %u", GetLastError());
    return false;
  }

  // Unite interface info structure and buffer big enough to contain the
  // largest structure.
  union {
    AdbInterfaceInfo interface_info;
    char buf[4096];
  };
  unsigned long buf_size = sizeof(buf);

  // Test each found interface
  while (AdbNextInterface(enum_handle, &interface_info, &buf_size)) {
    TestInterface(interface_info.device_name);
    buf_size = sizeof(buf);
  };

  AdbCloseHandle(enum_handle);

  // Create interface by VID/PID/MI
  ADBAPIHANDLE interface_handle =
      AdbCreateInterface(kAdbInterfaceId, DEVICE_VENDOR_ID,
                         DEVICE_COMPOSITE_PRODUCT_ID, DEVICE_INTERFACE_ID);
  if (NULL == interface_handle) {
    printf("\nUnable to create interface by VID/PID: %u", GetLastError());
    return false;
  }

  // Test it
  TestInterfaceHandle(interface_handle);
  AdbCloseHandle(interface_handle);
  return true;
}
Example #4
0
/*----------------------------------------------------------------------------------------*/
EFI_STATUS
SmmCpuProtocolEntry (
  IN       EFI_HANDLE         ImageHandle,
  IN       EFI_SYSTEM_TABLE   *SystemTable
  )
{
  EFI_STATUS                    Status;
  EFI_HANDLE                    SmmCpuProtocolHandle = NULL;
  UINTN                         i;
  BOOLEAN                       InSmm;

  // Locate Smmbase2 protocol
  Status = gBS->LocateProtocol (
                  &gEfiSmmBase2ProtocolGuid,
                  NULL,
                  &mSmmBasePtr
                  );

  ASSERT_EFI_ERROR (Status);
  if (EFI_ERROR (Status)) {
    return Status;
  }

  // Check if in Smm mode. Bail out if not
  mSmmBasePtr->InSmm (mSmmBasePtr, &InSmm);
  if (!InSmm) {
    return EFI_LOAD_ERROR;
  }

  //
  // We are in Smm mode
  //

  // Allocate buffer to save SmmBase of all the cores
  Status = gSmst->SmmAllocatePool (
                    EfiRuntimeServicesData,
                    sizeof (EFI_PHYSICAL_ADDRESS) * gSmst->NumberOfCpus,
                    &mCpuSaveBaseArray
                    );

  if (EFI_ERROR (Status)) {
    return Status;
  }

  // Get SmmBase of all cores and save in arrary allocated above
  for (i = 0; i < gSmst->NumberOfCpus; i++) {
    Status = gSmst->SmmStartupThisAp (
                     GetSmmBase,
                     i,
                     &mCpuSaveBaseArray[i]
                  );
    if (EFI_ERROR (Status)) {
      return Status;
    }

    DEBUG ((EFI_D_ERROR, "SmmCpuProtocol:: Cpu %x SmmBase %08x \n", i, mCpuSaveBaseArray[i]));
  }

  // All done install the SmmCpuProtocol
  Status = gSmst->SmmInstallProtocolInterface (
               &SmmCpuProtocolHandle,
               &gEfiSmmCpuProtocolGuid,
               EFI_NATIVE_INTERFACE,
               &mSmmCpuProtocol
               );
  if (EFI_ERROR (Status)) {
    return Status;
  }

  TestInterface ();

  return Status;
}