Einzelnen Beitrag anzeigen

schwa226

Registriert seit: 4. Apr 2008
400 Beiträge
 
#1

[SOLVED] TJvHidDeviceController, Probleme mit OnDeviceData

  Alt 24. Mär 2010, 17:10
Hi,

ich hab nun hier wieder einmal ein Problem, dass ein Programm auf einem PC geht, auf dem anderen nicht!

Beide PCs haben Win7 x86 drauf.

Ich habe hier einen Beispielcode der auch auf beiden PCs funktioniert.
Das bedeutet es kommen Daten in OnDeviceData an:
Delphi-Quellcode:
unit Unit4;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, JvComponentBase, JvHidControllerClass, HID, HidUsage, StdCtrls;

type
  TForm4 = class(TForm)
    JvHidDeviceController: TJvHidDeviceController;
    Memo1: TMemo;
    procedure OnArrival(HidDev: TJvHidDevice);
    procedure OnRemoval(HidDev: TJvHidDevice);
    procedure OnDeviceData(HidDev: TJvHidDevice; ReportID: Byte;
      const Data: Pointer; Size: Word);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

const
  VendorID = $16C0;
  ProductID = $05DF;
  ProductName = 'AVR USB';


var
  Form4: TForm4;
  HIDDevice: TJvHidDevice;
  ReceivedData : Array[0..5] of Byte;
implementation

{$R *.dfm}

procedure TForm4.OnDeviceData(HidDev: TJvHidDevice; ReportID: Byte;
  const Data: Pointer; Size: Word);
begin


  CopyMemory(@ReceivedData, Data, Size);
  Memo1.Lines.Add('Got Data!');
//test
end;

procedure TForm4.OnArrival(HidDev: TJvHidDevice);
var
  i : integer;
begin
  if ((HidDev.Attributes.VendorID = VendorID) AND
    (HidDev.Attributes.ProductID = ProductID) AND
    (HidDev.ProductName = ProductName )) then
  begin

    //store device:
    Memo1.Lines.Add('Device found');
    HIDDevice := HidDev;
    //device found, lets do the init:
    if HIDDevice.CheckOut then
      begin

        //set feature type
        HIDDevice.ReportTypeParam := HidP_Feature;
        HIDDevice.UsagePageParam := HID_USAGE_PAGE_GENERIC;
        HIDDevice.LinkCollectionParam := $01; // CollectionType=Application
        HIDDevice.UsageParam := HID_USAGE_CONSUMER_UNDEFINED;

      end;
  end;
end;

procedure TForm4.OnRemoval(HidDev: TJvHidDevice);
begin
  if ((Assigned(HIDDevice)) and (NOT HIDDevice.IsPluggedIn)) then
  begin
    JvHidDeviceController.CheckIn(HIDDevice);
  end;
end;

end.
Das ist eine selbständige EXE.

Nun habe ich den Code in ein Plugin (DVBViewer DLL) eingebaut.

Das Device wird auf beiden PCs erkannt. Jedoch wird nur bei einem PC die OnDeviceData ausgelößt!?


Woran kann das liegen? Wie kann ich dem auf die Spur kommen?
Auf beiden PCs ist die gleiche DVBViewer Version...
Hab den Source nocheinmal komplett neu gemacht, jedoch immer nur bei einem PC das OnDeviceData Event.

EDIT:
Der Code funktioniert einwandfrei! Nach einer Neuinstallation des DVBViewers geht es nun bei beiden PCs ohne Probleme...
Delphi 2010, Update 4 & 5
  Mit Zitat antworten Zitat