Author Topic: Sending Packets  (Read 3066 times)

JamesBrown

  • Newbie
  • *
  • Posts: 8
    • View Profile
Sending Packets
« on: August 13, 2009, 01:18:32 am »
Is there an example of sending a packet to a USB device?  There is a good one using pipes but I need one that uses packets.
Thanks......... Jim

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: Sending Packets
« Reply #1 on: August 15, 2009, 01:41:08 pm »
Hello

See the USBPipeDemo. It shows I/O operations over USB pipes. You can use same method for send anything what you need (one byte or byte sequence (packet)).

Roman Novgorodov
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

JamesBrown

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Sending Packets
« Reply #2 on: August 18, 2009, 10:42:21 pm »
Thanks for the reply Roman but:
I need to send a control message to a USB device that need to be initialized.
I need to do:

int usb_control_msg(usb_dev_handle *dev, int requesttype, int request, int value, int index, char *bytes, int size, int timeout);

Is this function available somehow?

Thanks........... Jim

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: Sending Packets
« Reply #3 on: August 20, 2009, 06:49:15 pm »
Hello

It seems like you need WinUsb_ControlTransfer() call.

Unfortunately, current version have no such method, we will include it in the next relese asap.

You can try use this call directly:
WinUsb_ControlTransfer(nrUsb1.Handle, ...);
Please more info you can find here:
http://msdn.microsoft.com/en-us/library/aa476436.aspx

Roman Novgorodov
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

JamesBrown

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Sending Packets
« Reply #4 on: August 22, 2009, 10:37:44 pm »
I had an idea Roman.

Its verry difficult for me to grasp the problems with coding for WinUSB.  I think its because I have always coded in Delphi and it shields me from most of the stuff a C++ or C# coder has to put up with.

It would be great if you could write some demo code for the OSR USB-FX2 Learning Kit (Driver, Device and Pipe).  That way anyone could buy the kit and run your demo and know that at least it should work.  Should help you sell more softwre too.

Using WinUSB for User-Mode: http://www.osronline.com/article.cfm?article=532
OSR FX2 Learning Kit :http://www.osronline.com/article.cfm?article=382

Have you thought of doing this?

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: Sending Packets
« Reply #5 on: August 23, 2009, 06:07:00 am »
Hello

Thank you for information.

We know well about OSR USB-FX2 Learning Kit.

Today I have ordered this board. Now we are waiting for shipping this device.

When device will arrived we will try to create special demo project sample for it.
But, please note that the shipping can take a long time for our region.

Roman Novgorodov
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

JamesBrown

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Sending Packets
« Reply #6 on: August 24, 2009, 06:07:50 pm »
It seems like you need WinUsb_ControlTransfer() call.

You can try use this call directly:
WinUsb_ControlTransfer(nrUsb1.Handle, ...);

Roman - Can you give me a small sample of how I would do this call?  I don't understand how to link Delphi to the structures that contain WinUSB_ControlTransfer.

Thanks..... Jim