Upon further investigation, it looks like the firmware is getting to the device properly.

However, it is not being completely initialised (for lack of a better word). USB Prober reports the right config descriptor, listing down the 4 endpoints. However, in the "Number of Endpoints" node, it still only lists down the control endpoint.

I have found that if I do this:
1 - In OSX, send firmware to device
2 - Connect to my VM linux
3 - Disconnect from VM linux
4 - Refresh USB Prober, it now displays the correct number of endpoints and is available to use for the mac.

So somehow connecting it to the linux somehow caused the device to refresh/reset? and work properly.

Here's how I'm doing it now:

Write firmware to device using libusb_control_transfer, then
    libusb_reset_device(dev->handle);
    libusb_close(dev->handle);
    usleep(250000);
    handle = dev->handle = libusb_open_device_with_vid_pid(ctx, 0x0955, 0x0007);
    libusb_reset_device(dev->handle);
    
    usleep(250000);
    
    libusb_set_configuration(dev->handle, 1);
    libusb_claim_interface(dev->handle, 0);

This works perfectly on Linux btw.
Can anyone help on how to get it to work on OSX w/o connecting it to a vm?




On Fri, Jan 4, 2013 at 3:47 PM, Kurayami Tenshi <kurayami.tenshi@gmail.com> wrote:



On Fri, Jan 4, 2013 at 3:17 PM, Xiaofan Chen <xiaofanc@gmail.com> wrote:
On Fri, Jan 4, 2013 at 3:08 PM, Kurayami Tenshi
<kurayami.tenshi@gmail.com> wrote:
> To add on more info,
> When the device first is plugged in, OSX does report 1 endpoint, which I
> guess is the control endpoint.

Please post what USB Prober reports at this time about your device.

> So does this mean that the device is enumerated properly?
>
> The device is supposed to have 4 more endpoints when it is properly
> initialised, this is done only after its firmware is loaded.
>
> It works in OSX when I do this:
> In a VM linux, I initialise the device.
> lsusb then reports 4 endpoints.
> I disconnect it from the vm and it gets reconnect to the host OS (which is
> OSX), and USB Prober will report 5 endpoints (1 control, 4 others).

Please report the output of USB Prober at this time.

I've attached 2 files.
USB Bus Probe on plugin.txt
- USB Probe's output when the device is first plugged in.
USB Bus Probe after init.txt
- Output after the device has been initialised in my VM linux.


This is what the debug build from HEAD reports on OSX:
During initialisation:
libusb: 0.385674 info [process_new_device] allocating new device for location 0x1a120000
libusb: 0.385876 debug [darwin_cache_device_descriptor] device descriptor:
libusb: 0.385892 debug [darwin_cache_device_descriptor]  bDescriptorType:    0x01
libusb: 0.385900 debug [darwin_cache_device_descriptor]  bcdUSB:             0x0200
libusb: 0.385909 debug [darwin_cache_device_descriptor]  bDeviceClass:       0x00
libusb: 0.385917 debug [darwin_cache_device_descriptor]  bDeviceSubClass:    0x00
libusb: 0.385925 debug [darwin_cache_device_descriptor]  bDeviceProtocol:    0x00
libusb: 0.385933 debug [darwin_cache_device_descriptor]  bMaxPacketSize0:    0x40
libusb: 0.385941 debug [darwin_cache_device_descriptor]  idVendor:           0x0955
libusb: 0.385949 debug [darwin_cache_device_descriptor]  idProduct:          0x0007
libusb: 0.385957 debug [darwin_cache_device_descriptor]  bcdDevice:          0x0300
libusb: 0.385964 debug [darwin_cache_device_descriptor]  iManufacturer:      0x01
libusb: 0.385971 debug [darwin_cache_device_descriptor]  iProduct:           0x02
libusb: 0.385980 debug [darwin_cache_device_descriptor]  iSerialNumber:      0x00
libusb: 0.385988 debug [darwin_cache_device_descriptor]  bNumConfigurations: 0x01
libusb: 0.386033 info [darwin_check_configuration] active config: 1, first config: 1
libusb: 0.386044 debug [discovered_devs_append] need to increase capacity
libusb: 0.386062 info [process_new_device] found device with address 3 at 003-0955-0007-00-00
libusb: 0.386198 debug [libusb_get_device_descriptor] 
libusb: 0.386207 debug [libusb_get_device_descriptor] 
libusb: 0.386213 debug [libusb_get_device_descriptor] 
libusb: 0.386219 debug [libusb_get_device_descriptor] 
libusb: 0.386224 debug [libusb_get_device_descriptor] 
libusb: 0.386229 debug [libusb_get_device_descriptor] 
libusb: 0.386235 debug [libusb_get_device_descriptor] 
libusb: 0.386240 debug [libusb_get_device_descriptor] 
libusb: 0.386246 debug [libusb_get_device_descriptor] 
libusb: 0.386252 debug [libusb_open] open 26.3
libusb: 0.387027 debug [usbi_add_pollfd] add fd 7 events 1
libusb: 0.387045 info [darwin_open] device open for access

Ok looks good, it found the device requested.

Loading the firmware into the device:

It reads the firmware file and sends it to the device:
<while <read segments of the file>, put it into the buffer and do>
libusb_control_transfer(
      dev->handle,
      LIBUSB_REQUEST_TYPE_VENDOR, 
      0xA0, 
      pos, 0x0000,
      buf, length,
      0
    );


libusb: 0.387309 debug [libusb_get_next_timeout] no URB with timeout or all handled by OS; no timeout!
libusb: 0.387325 debug [libusb_handle_events_timeout_completed] doing our own event handling
libusb: 0.387335 debug [handle_events] poll() 2 fds with timeout in 60000ms
libusb: 0.387488 info [darwin_async_io_callback] an async io operation has completed
libusb: 0.387519 debug [handle_events] poll() returned 1
libusb: 0.387536 info [op_handle_events] checking fd 5 with revents = 0
libusb: 0.387541 info [op_handle_events] checking fd 7 with revents = 1
libusb: 0.387549 info [darwin_handle_callback] handling control completion with kernel status 0
libusb: 0.387554 debug [usbi_handle_transfer_completion] transfer 0x7f9a55002440 has callback 0x109e4f660
libusb: 0.387561 debug [ctrl_transfer_cb] actual_length=1
libusb: 0.387645 debug [libusb_get_next_timeout] no URB with timeout or all handled by OS; no timeout!
libusb: 0.387657 debug [libusb_handle_events_timeout_completed] doing our own event handling
libusb: 0.387665 debug [handle_events] poll() 2 fds with timeout in 60000ms
libusb: 0.387706 info [darwin_async_io_callback] an async io operation has completed
libusb: 0.387726 debug [handle_events] poll() returned 1
libusb: 0.387738 info [op_handle_events] checking fd 5 with revents = 0
libusb: 0.398699 info [op_handle_events] checking fd 7 with revents = 1
libusb: 0.398721 info [darwin_handle_callback] handling control completion with kernel status 0
libusb: 0.398726 debug [usbi_handle_transfer_completion] transfer 0x7f9a553037d0 has callback 0x109e4f660
libusb: 0.398735 debug [ctrl_transfer_cb] actual_length=6
libusb: 0.398833 debug [libusb_get_next_timeout] no URB with timeout or all handled by OS; no timeout!
libusb: 0.398846 debug [libusb_handle_events_timeout_completed] doing our own event handling
libusb: 0.398855 debug [handle_events] poll() 2 fds with timeout in 60000ms
libusb: 0.398993 info [darwin_async_io_callback] an async io operation has completed
libusb: 0.399025 debug [handle_events] poll() returned 1
libusb: 0.399040 info [op_handle_events] checking fd 5 with revents = 0
libusb: 0.399046 info [op_handle_events] checking fd 7 with revents = 1
libusb: 0.399056 info [darwin_handle_callback] handling control completion with kernel status 0
libusb: 0.399061 debug [usbi_handle_transfer_completion] transfer 0x7f9a553037d0 has callback 0x109e4f660
libusb: 0.399069 debug [ctrl_transfer_cb] actual_length=3
libusb: 0.399151 debug [libusb_get_next_timeout] no URB with timeout or all handled by OS; no timeout!
libusb: 0.399163 debug [libusb_handle_events_timeout_completed] doing our own event handling
libusb: 0.399171 debug [handle_events] poll() 2 fds with timeout in 60000ms
libusb: 0.399214 info [darwin_async_io_callback] an async io operation has completed
libusb: 0.399236 debug [handle_events] poll() returned 1
libusb: 0.399247 info [op_handle_events] checking fd 5 with revents = 0
libusb: 0.399252 info [op_handle_events] checking fd 7 with revents = 1
libusb: 0.399260 info [darwin_handle_callback] handling control completion with kernel status 0
libusb: 0.399265 debug [usbi_handle_transfer_completion] transfer 0x7f9a553037d0 has callback 0x109e4f660
libusb: 0.399274 debug [ctrl_transfer_cb] actual_length=3
libusb: 0.399348 debug [libusb_get_next_timeout] no URB with timeout or all handled by OS; no timeout!
libusb: 0.399360 debug [libusb_handle_events_timeout_completed] doing our own event handling
libusb: 0.399367 debug [handle_events] poll() 2 fds with timeout in 60000ms
libusb: 0.399462 info [darwin_async_io_callback] an async io operation has completed
libusb: 0.399489 debug [handle_events] poll() returned 1
libusb: 0.399500 info [op_handle_events] checking fd 5 with revents = 0
libusb: 0.399504 info [op_handle_events] checking fd 7 with revents = 1
libusb: 0.399514 info [darwin_handle_callback] handling control completion with kernel status 0
libusb: 0.399520 debug [usbi_handle_transfer_completion] transfer 0x7f9a553037d0 has callback 0x109e4f660
libusb: 0.399547 debug [ctrl_transfer_cb] actual_length=3
libusb: 0.399632 debug [libusb_get_next_timeout] no URB with timeout or all handled by OS; no timeout!
libusb: 0.399643 debug [libusb_handle_events_timeout_completed] doing our own event handling
libusb: 0.399652 debug [handle_events] poll() 2 fds with timeout in 60000ms
libusb: 0.399709 info [darwin_async_io_callback] an async io operation has completed
libusb: 0.399730 debug [handle_events] poll() returned 1
libusb: 0.399742 info [op_handle_events] checking fd 5 with revents = 0
libusb: 0.399745 info [op_handle_events] checking fd 7 with revents = 1
libusb: 0.399753 info [darwin_handle_callback] handling control completion with kernel status 0
libusb: 0.399756 debug [usbi_handle_transfer_completion] transfer 0x7f9a55002440 has callback 0x109e4f660
libusb: 0.399761 debug [ctrl_transfer_cb] actual_length=3
libusb: 0.399828 debug [libusb_get_next_timeout] no URB with timeout or all handled by OS; no timeout!
libusb: 0.399841 debug [libusb_handle_events_timeout_completed] doing our own event handling
libusb: 0.399849 debug [handle_events] poll() 2 fds with timeout in 60000ms
libusb: 0.399964 info [darwin_async_io_callback] an async io operation has completed
libusb: 0.399991 debug [handle_events] poll() returned 1
libusb: 0.400002 info [op_handle_events] checking fd 5 with revents = 0
libusb: 0.400008 info [op_handle_events] checking fd 7 with revents = 1
libusb: 0.400018 info [darwin_handle_callback] handling control completion with kernel status 0
libusb: 0.400024 debug [usbi_handle_transfer_completion] transfer 0x7f9a553037d0 has callback 0x109e4f660
libusb: 0.400033 debug [ctrl_transfer_cb] actual_length=3
libusb: 0.400110 debug [libusb_get_next_timeout] no URB with timeout or all handled by OS; no timeout!
libusb: 0.400121 debug [libusb_handle_events_timeout_completed] doing our own event handling
libusb: 0.400130 debug [handle_events] poll() 2 fds with timeout in 60000ms
libusb: 0.400213 info [darwin_async_io_callback] an async io operation has completed
libusb: 0.400236 debug [handle_events] poll() returned 1
libusb: 0.400247 info [op_handle_events] checking fd 5 with revents = 0
libusb: 0.400251 info [op_handle_events] checking fd 7 with revents = 1
libusb: 0.400258 info [darwin_handle_callback] handling control completion with kernel status 0
libusb: 0.400262 debug [usbi_handle_transfer_completion] transfer 0x7f9a55002440 has callback 0x109e4f660
libusb: 0.400266 debug [ctrl_transfer_cb] actual_length=3
libusb: 0.400340 debug [libusb_get_next_timeout] no URB with timeout or all handled by OS; no timeout!
libusb: 0.400352 debug [libusb_handle_events_timeout_completed] doing our own event handling
libusb: 0.400360 debug [handle_events] poll() 2 fds with timeout in 60000ms
libusb: 0.400462 info [darwin_async_io_callback] an async io operation has completed
libusb: 0.400486 debug [handle_events] poll() returned 1
libusb: 0.400501 info [op_handle_events] checking fd 5 with revents = 0
libusb: 0.400506 info [op_handle_events] checking fd 7 with revents = 1
libusb: 0.400516 info [darwin_handle_callback] handling control completion with kernel status 0
libusb: 0.400521 debug [usbi_handle_transfer_completion] transfer 0x7f9a553037d0 has callback 0x109e4f660
libusb: 0.400530 debug [ctrl_transfer_cb] actual_length=3
libusb: 0.400606 debug [libusb_get_next_timeout] no URB with timeout or all handled by OS; no timeout!
libusb: 0.400618 debug [libusb_handle_events_timeout_completed] doing our own event handling
libusb: 0.400626 debug [handle_events] poll() 2 fds with timeout in 60000ms
libusb: 0.400711 info [darwin_async_io_callback] an async io operation has completed
libusb: 0.400731 debug [handle_events] poll() returned 1
libusb: 0.400743 info [op_handle_events] checking fd 5 with revents = 0
libusb: 0.400747 info [op_handle_events] checking fd 7 with revents = 1
libusb: 0.400754 info [darwin_handle_callback] handling control completion with kernel status 0
libusb: 0.400757 debug [usbi_handle_transfer_completion] transfer 0x7f9a55002440 has callback 0x109e4f660
libusb: 0.400762 debug [ctrl_transfer_cb] actual_length=3
libusb: 0.400827 debug [libusb_get_next_timeout] no URB with timeout or all handled by OS; no timeout!
libusb: 0.400839 debug [libusb_handle_events_timeout_completed] doing our own event handling
libusb: 0.400848 debug [handle_events] poll() 2 fds with timeout in 60000ms
libusb: 0.400961 info [darwin_async_io_callback] an async io operation has completed
libusb: 0.400986 debug [handle_events] poll() returned 1
libusb: 0.400998 info [op_handle_events] checking fd 5 with revents = 0
libusb: 0.401003 info [op_handle_events] checking fd 7 with revents = 1
libusb: 0.401011 info [darwin_handle_callback] handling control completion with kernel status 0
libusb: 0.401017 debug [usbi_handle_transfer_completion] transfer 0x7f9a553037d0 has callback 0x109e4f660
libusb: 0.401025 debug [ctrl_transfer_cb] actual_length=3
libusb: 0.401104 debug [libusb_get_next_timeout] no URB with timeout or all handled by OS; no timeout!
libusb: 0.401115 debug [libusb_handle_events_timeout_completed] doing our own event handling
libusb: 0.401123 debug [handle_events] poll() 2 fds with timeout in 60000ms
libusb: 0.401209 info [darwin_async_io_callback] an async io operation has completed
libusb: 0.401231 debug [handle_events] poll() returned 1
libusb: 0.401250 info [op_handle_events] checking fd 5 with revents = 0
libusb: 0.401291 info [op_handle_events] checking fd 7 with revents = 1
libusb: 0.401303 info [darwin_handle_callback] handling control completion with kernel status 0
libusb: 0.401308 debug [usbi_handle_transfer_completion] transfer 0x7f9a55002440 has callback 0x109e4f660
libusb: 0.401317 debug [ctrl_transfer_cb] actual_length=3
libusb: 0.401427 debug [libusb_get_next_timeout] no URB with timeout or all handled by OS; no timeout!
libusb: 0.401438 debug [libusb_handle_events_timeout_completed] doing our own event handling
libusb: 0.401445 debug [handle_events] poll() 2 fds with timeout in 60000ms
libusb: 0.401495 info [darwin_async_io_callback] an async io operation has completed
libusb: 0.401520 debug [handle_events] poll() returned 1
libusb: 0.401531 info [op_handle_events] checking fd 5 with revents = 0
libusb: 0.401535 info [op_handle_events] checking fd 7 with revents = 1
libusb: 0.401542 info [darwin_handle_callback] handling control completion with kernel status 0
libusb: 0.401547 debug [usbi_handle_transfer_completion] transfer 0x7f9a55002440 has callback 0x109e4f660
libusb: 0.401552 debug [ctrl_transfer_cb] actual_length=3
libusb: 0.401638 debug [libusb_get_next_timeout] no URB with timeout or all handled by OS; no timeout!
libusb: 0.401652 debug [libusb_handle_events_timeout_completed] doing our own event handling
libusb: 0.401660 debug [handle_events] poll() 2 fds with timeout in 60000ms
libusb: 0.401723 info [darwin_async_io_callback] an async io operation has completed
libusb: 0.401747 debug [handle_events] poll() returned 1
libusb: 0.401758 info [op_handle_events] checking fd 5 with revents = 0
libusb: 0.401763 info [op_handle_events] checking fd 7 with revents = 1
libusb: 0.401773 info [darwin_handle_callback] handling control completion with kernel status 0
libusb: 0.401778 debug [usbi_handle_transfer_completion] transfer 0x7f9a55200190 has callback 0x109e4f660
libusb: 0.401786 debug [ctrl_transfer_cb] actual_length=1023
libusb: 0.401876 debug [libusb_get_next_timeout] no URB with timeout or all handled by OS; no timeout!
libusb: 0.401886 debug [libusb_handle_events_timeout_completed] doing our own event handling
libusb: 0.401895 debug [handle_events] poll() 2 fds with timeout in 60000ms
libusb: 0.401989 info [darwin_async_io_callback] an async io operation has completed
libusb: 0.402133 debug [handle_events] poll() returned 1
libusb: 0.402194 info [op_handle_events] checking fd 5 with revents = 0
libusb: 0.402201 info [op_handle_events] checking fd 7 with revents = 1
libusb: 0.402211 info [darwin_handle_callback] handling control completion with kernel status 0
libusb: 0.402216 debug [usbi_handle_transfer_completion] transfer 0x7f9a55002440 has callback 0x109e4f660
libusb: 0.402225 debug [ctrl_transfer_cb] actual_length=1023
libusb: 0.402309 debug [libusb_get_next_timeout] no URB with timeout or all handled by OS; no timeout!
libusb: 0.402321 debug [libusb_handle_events_timeout_completed] doing our own event handling
libusb: 0.402329 debug [handle_events] poll() 2 fds with timeout in 60000ms
libusb: 0.402376 info [darwin_async_io_callback] an async io operation has completed
libusb: 0.402399 debug [handle_events] poll() returned 1
libusb: 0.402413 info [op_handle_events] checking fd 5 with revents = 0
libusb: 0.402419 info [op_handle_events] checking fd 7 with revents = 1
libusb: 0.402427 info [darwin_handle_callback] handling control completion with kernel status 0
libusb: 0.402432 debug [usbi_handle_transfer_completion] transfer 0x7f9a553037d0 has callback 0x109e4f660
libusb: 0.402439 debug [ctrl_transfer_cb] actual_length=1023
libusb: 0.402528 debug [libusb_get_next_timeout] no URB with timeout or all handled by OS; no timeout!
libusb: 0.402539 debug [libusb_handle_events_timeout_completed] doing our own event handling
libusb: 0.402549 debug [handle_events] poll() 2 fds with timeout in 60000ms
libusb: 0.402591 info [darwin_async_io_callback] an async io operation has completed
libusb: 0.402611 debug [handle_events] poll() returned 1
libusb: 0.402626 info [op_handle_events] checking fd 5 with revents = 0
libusb: 0.402631 info [op_handle_events] checking fd 7 with revents = 1
libusb: 0.402640 info [darwin_handle_callback] handling control completion with kernel status 0
libusb: 0.402645 debug [usbi_handle_transfer_completion] transfer 0x7f9a55002440 has callback 0x109e4f660
libusb: 0.402654 debug [ctrl_transfer_cb] actual_length=1023
libusb: 0.402744 debug [libusb_get_next_timeout] no URB with timeout or all handled by OS; no timeout!
libusb: 0.402756 debug [libusb_handle_events_timeout_completed] doing our own event handling
libusb: 0.402763 debug [handle_events] poll() 2 fds with timeout in 60000ms
libusb: 0.402849 info [darwin_async_io_callback] an async io operation has completed
libusb: 0.402873 debug [handle_events] poll() returned 1
libusb: 0.402888 info [op_handle_events] checking fd 5 with revents = 0
libusb: 0.402893 info [op_handle_events] checking fd 7 with revents = 1
libusb: 0.402902 info [darwin_handle_callback] handling control completion with kernel status 0
libusb: 0.402907 debug [usbi_handle_transfer_completion] transfer 0x7f9a553037d0 has callback 0x109e4f660
libusb: 0.402928 debug [ctrl_transfer_cb] actual_length=1023
libusb: 0.403006 debug [libusb_get_next_timeout] no URB with timeout or all handled by OS; no timeout!
libusb: 0.403017 debug [libusb_handle_events_timeout_completed] doing our own event handling
libusb: 0.403025 debug [handle_events] poll() 2 fds with timeout in 60000ms
libusb: 0.403087 info [darwin_async_io_callback] an async io operation has completed
libusb: 0.403113 debug [handle_events] poll() returned 1
libusb: 0.403124 info [op_handle_events] checking fd 5 with revents = 0
libusb: 0.403129 info [op_handle_events] checking fd 7 with revents = 1
libusb: 0.403172 info [darwin_handle_callback] handling control completion with kernel status 0
libusb: 0.403182 debug [usbi_handle_transfer_completion] transfer 0x7f9a55002440 has callback 0x109e4f660
libusb: 0.403191 debug [ctrl_transfer_cb] actual_length=475
libusb: 0.403272 debug [libusb_get_next_timeout] no URB with timeout or all handled by OS; no timeout!
libusb: 0.403284 debug [libusb_handle_events_timeout_completed] doing our own event handling
libusb: 0.403291 debug [handle_events] poll() 2 fds with timeout in 60000ms
libusb: 0.403341 info [darwin_async_io_callback] an async io operation has completed
libusb: 0.403366 debug [handle_events] poll() returned 1
libusb: 0.403377 info [op_handle_events] checking fd 5 with revents = 0
libusb: 0.403382 info [op_handle_events] checking fd 7 with revents = 1
libusb: 0.403391 info [darwin_handle_callback] handling control completion with kernel status 0
libusb: 0.403396 debug [usbi_handle_transfer_completion] transfer 0x7f9a553037d0 has callback 0x109e4f660
libusb: 0.403404 debug [ctrl_transfer_cb] actual_length=430
libusb: 0.403479 debug [libusb_get_next_timeout] no URB with timeout or all handled by OS; no timeout!
libusb: 0.403492 debug [libusb_handle_events_timeout_completed] doing our own event handling
libusb: 0.403598 debug [handle_events] poll() 2 fds with timeout in 60000ms
libusb: 0.403619 info [darwin_async_io_callback] an async io operation has completed
libusb: 0.403640 debug [handle_events] poll() returned 1
libusb: 0.403651 info [op_handle_events] checking fd 5 with revents = 0
libusb: 0.403655 info [op_handle_events] checking fd 7 with revents = 1
libusb: 0.403665 info [darwin_handle_callback] handling control completion with kernel status 0
libusb: 0.403670 debug [usbi_handle_transfer_completion] transfer 0x7f9a553037d0 has callback 0x109e4f660
libusb: 0.403678 debug [ctrl_transfer_cb] actual_length=184
libusb: 0.403754 debug [libusb_get_next_timeout] no URB with timeout or all handled by OS; no timeout!
libusb: 0.403765 debug [libusb_handle_events_timeout_completed] doing our own event handling
libusb: 0.403772 debug [handle_events] poll() 2 fds with timeout in 60000ms
libusb: 0.403836 info [darwin_async_io_callback] an async io operation has completed
libusb: 0.403862 debug [handle_events] poll() returned 1
libusb: 0.403884 info [op_handle_events] checking fd 5 with revents = 0
libusb: 0.403890 info [op_handle_events] checking fd 7 with revents = 1
libusb: 0.403910 info [darwin_handle_callback] handling control completion with kernel status 0
libusb: 0.403915 debug [usbi_handle_transfer_completion] transfer 0x7f9a553037d0 has callback 0x109e4f660
libusb: 0.403924 debug [ctrl_transfer_cb] actual_length=1