SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

BulkRead problem.... Need Assistance.

Last post 08-23-2006 11:47 AM by bisao. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 07-25-2006 5:20 PM

    • linhardt
    • Not Ranked
    • Joined on 07-25-2006
    • Jefferson City, Missouri USA
    • Posts 3

    BulkRead problem.... Need Assistance.

    I am having trouble getting the code correct to read the USB.  I have connection but not sure of the correct way to code to get the BulkRead() to read the data from the port and put into a string.

    Can anyone help me with this???????

    using ICSharpCode.USBlib;


    const
    int VENDOR_ID = 4505;

    const int PRODUCT_ID = 25703;

    Device device;

    private void gpsUSB()

    {

           foreach (Bus bus in Bus.Busses) {

                  foreach (Descriptor descriptor in bus.Descriptors) {

                        if (descriptor.VendorId == VENDOR_ID &&

                           descriptor.ProductId == PRODUCT_ID) {

                           device = descriptor.OpenDevice();

                           return;

                          }      

                     }

              }

    }

    private void readUSB()

    {

                  device.BulkRead();

                  return;

    }

    Anthony Linhardt
    Filed under:
  • 07-25-2006 9:54 PM In reply to

    • linhardt
    • Not Ranked
    • Joined on 07-25-2006
    • Jefferson City, Missouri USA
    • Posts 3

    Re: BulkRead problem.... Need Assistance.

    Anyone??  I am still in desperate need of help!!  I just need to know how to write up the code to do the reading and get the data from the device into a string.

    I ran the TestLibUsb.exe to get the device info. and here is what it has:

     

    bus-3/\\.\libusb0-0011--0x1199-0x6467     1199/6467
    - Serial Number: 0123456789
      wTotalLength:         46
      bNumInterfaces:       1
      bConfigurationValue:  1
      iConfiguration:       0
      bmAttributes:         c0h
      MaxPower:             1
        bInterfaceNumber:   0
        bAlternateSetting:  0
        bNumEndpoints:      4
        bInterfaceClass:    220
        bInterfaceSubClass: 160
        bInterfaceProtocol: 176
        iInterface:         0
          bEndpointAddress: 81h
          bmAttributes:     03h
          wMaxPacketSize:   16
          bInterval:        10
          bRefresh:         0
          bSynchAddress:    0
          bEndpointAddress: 01h
          bmAttributes:     03h
          wMaxPacketSize:   16
          bInterval:        10
          bRefresh:         0
          bSynchAddress:    0
          bEndpointAddress: 82h
          bmAttributes:     02h
          wMaxPacketSize:   64
          bInterval:        10
          bRefresh:         0
          bSynchAddress:    0
          bEndpointAddress: 02h
          bmAttributes:     02h
          wMaxPacketSize:   64
          bInterval:        10
          bRefresh:         0
          bSynchAddress:    0

    Anthony Linhardt
  • 07-27-2006 5:25 PM In reply to

    • linhardt
    • Not Ranked
    • Joined on 07-25-2006
    • Jefferson City, Missouri USA
    • Posts 3

    Re: BulkRead problem.... Need Assistance.

    Can anyone give some assistance on this??
    Anthony Linhardt
  • 08-23-2006 11:47 AM In reply to

    • bisao
    • Not Ranked
    • Joined on 08-22-2006
    • Posts 2

    Re: BulkRead problem.... Need Assistance.

    Hi! I have a similar problem, but you haven't used correctly the function BulkRead.

    This function doesn't return a value but take in input two parameters:

    int endpoint, byte[] msg

    msg is an array defined before where the byte read from the endpoint was put.

    but how endpoint do I use???

    Something can response this question? There was another methodto use before the bulkread? For example, what does SendControlMessage do?

    Thanks.

    Nicola 

Page 1 of 1 (4 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.