public static unsafe IntPtr[] GetDeviceList(int vendor, int product)
        {
            ArrayList         ar = new ArrayList();
            ftdi_device_list *devlist, d;
            ftdi_context      ftdi = new ftdi_context();

            ftdi_init(ref ftdi);

            if (ftdi_usb_find_all(ref ftdi, &devlist, vendor, product) < 0)
            {
                throw new Exception("ftdi_usb_find_all failed");
            }

            for (d = devlist; d != null; d = d->next)
            {
                ar.Add(d->dev);
            }

            ftdi_deinit(ref ftdi);

            ftdi_list_free(&devlist);

            return((IntPtr[])ar.ToArray(typeof(IntPtr)));
        }
示例#2
0
 [DllImport("libftdi1", CallingConvention = CallingConvention.Cdecl)] internal static extern int ftdi_enable_bitbang(ref ftdi_context ftdi, byte bitmask);
 [DllImport("libftdi1")] internal unsafe static extern int ftdi_usb_find_all(ref ftdi_context ftdi, ftdi_device_list **devlist, int vendor, int product);
 [DllImport("libftdi1")] internal static extern int ftdi_set_bitmode(ref ftdi_context ftdi, byte bitmask, byte mode);
 [DllImport("libftdi1")] internal static extern int ftdi_enable_bitbang(ref ftdi_context ftdi, byte bitmask);
 [DllImport("libftdi1")] internal static extern int ftdi_set_interface(ref ftdi_context ftdi, Interface iface);
 [DllImport("libftdi1")] internal static extern int ftdi_erase_eeprom(ref ftdi_context ftdi);
 [DllImport("libftdi1")] internal static extern IntPtr ftdi_get_error_string(ref ftdi_context ftdi);
 [DllImport("libftdi1")] internal static extern void ftdi_deinit(ref ftdi_context ftdi);
 [DllImport("libftdi1")] internal static extern int ftdi_init(ref ftdi_context ftdi);
示例#11
0
 // "eeprom" needs to be valid 128 byte eeprom (generated by the eeprom generator)
 // the checksum of the eeprom is valided
 [DllImport("libftdi")] internal static extern int ftdi_read_eeprom(ref ftdi_context ftdi, ref byte[] eeprom);
示例#12
0
 [DllImport("libftdi")] internal static extern int ftdi_usb_reset(ref ftdi_context ftdi);
示例#13
0
 [DllImport("libftdi1", CallingConvention = CallingConvention.Cdecl)] internal static extern int ftdi_set_line_property(ref ftdi_context ftdi, BitsType bits, StopBitsType sbit, ParityType parity);
示例#14
0
 [DllImport("libftdi1", CallingConvention = CallingConvention.Cdecl)] internal static extern int ftdi_set_bitmode(ref ftdi_context ftdi, byte bitmask, byte mode);
示例#15
0
 [DllImport("libftdi1", CallingConvention = CallingConvention.Cdecl)] internal static extern int ftdi_disable_bitbang(ref ftdi_context ftdi);
 [DllImport("libftdi1")] internal static extern int ftdi_write_data_get_chunksize(ref ftdi_context ftdi, out uint chunksize);
 [DllImport("libftdi1")] internal static extern int ftdi_get_latency_timer(ref ftdi_context ftdi, out byte latency);
 [DllImport("libftdi1")] internal static extern int ftdi_usb_open(ref ftdi_context ftdi, int vendor, int product);
 [DllImport("libftdi1")] internal static extern int ftdi_write_eeprom(ref ftdi_context ftdi, ref byte[] eeprom);
 [DllImport("libftdi1")] internal static extern int ftdi_usb_open_desc(ref ftdi_context ftdi, int vendor, int product, string description, string serial);
 [DllImport("libftdi1")] internal static extern int ftdi_write_data(ref ftdi_context ftdi, byte[] buf, int size);
 [DllImport("libftdi1")] internal static extern int ftdi_usb_open_dev(ref ftdi_context ftdi, IntPtr dev);
 [DllImport("libftdi1")] internal static extern int ftdi_read_pins(ref ftdi_context ftdi, out byte pins);
 [DllImport("libftdi1")] internal static extern int ftdi_set_baudrate(ref ftdi_context ftdi, int baudrate);
 [DllImport("libftdi1")] internal static extern int ftdi_disable_bitbang(ref ftdi_context ftdi);
 [DllImport("libftdi1")] internal static extern int ftdi_usb_close(ref ftdi_context ftdi);
 [DllImport("libftdi1")] internal static extern int ftdi_set_line_property(ref ftdi_context ftdi, BitsType bits, StopBitsType sbit, ParityType parity);
 [DllImport("libftdi1")] internal static extern int ftdi_usb_purge_buffers(ref ftdi_context ftdi);
 [DllImport("libftdi1")] internal static extern int ftdi_read_data_set_chunksize(ref ftdi_context ftdi, uint chunksize);
示例#30
0
 [DllImport("libftdi1", CallingConvention = CallingConvention.Cdecl)] internal static extern int ftdi_read_pins(ref ftdi_context ftdi, out byte pins);