Subversion Repositories freemyipod

Rev

Rev 786 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 786 Rev 790
Line 60... Line 60...
60
 
60
 
61
int usb_find(uint16_t vendor_id, uint16_t product_id, uint8_t* reattach)
61
int usb_find(uint16_t vendor_id, uint16_t product_id, uint8_t* reattach)
62
{
62
{
63
    libusb_device **devs, *dev;
63
    libusb_device **devs, *dev;
64
    ssize_t devs_cnt;
64
    ssize_t devs_cnt;
65
    int res, i;
65
    int res, i, j;
66
    struct libusb_device_descriptor dev_desc;
66
    struct libusb_device_descriptor dev_desc;
67
    uint8_t found = 0;
67
    uint8_t found = 0;
68
    struct libusb_config_descriptor* cfg_desc;
68
    struct libusb_config_descriptor* cfg_desc;
69
    const struct libusb_interface* iface;
69
    const struct libusb_interface* iface;
70
    const struct libusb_interface_descriptor* iface_desc;
70
    const struct libusb_interface_descriptor* iface_desc;
Line 80... Line 80...
80
    {
80
    {
81
        return devs_cnt;
81
        return devs_cnt;
82
    }
82
    }
83
 
83
 
84
#ifdef DEBUG
84
#ifdef DEBUG
85
    fprintf(stderr, "Found %ld USB devices!\n", devs_cnt);
85
    fprintf(stderr, "Found %Zd USB devices!\n", devs_cnt);
86
#endif
86
#endif
87
    for (i = 0; i < devs_cnt; ++i)
87
    for (i = 0; i < devs_cnt; ++i)
88
    {
88
    {
89
        dev = devs[i];
89
        dev = devs[i];
90
#ifdef DEBUG
90
#ifdef DEBUG
Line 162... Line 162...
162
 
162
 
163
#ifdef DEBUG
163
#ifdef DEBUG
164
           fprintf(stderr, "Endpoints:");
164
           fprintf(stderr, "Endpoints:");
165
#endif
165
#endif
166
 
166
 
167
            for (i = 0; i < 4; ++i)
167
            for (j = 0; j < 4; ++j)
168
            {
168
            {
169
                ep_desc = &iface_desc->endpoint[i];
169
                ep_desc = &iface_desc->endpoint[j];
170
 
170
 
171
#ifdef DEBUG
171
#ifdef DEBUG
172
                fprintf(stderr, " %d at 0x%02x", i, ep_desc->bEndpointAddress);
172
                fprintf(stderr, " %d at 0x%02x", j, ep_desc->bEndpointAddress);
173
#endif
173
#endif
174
 
174
 
175
                switch (i) {
175
                switch (j) {
176
                    case 0:
176
                    case 0:
177
                        emcore_usb_eps_addr.cout = ep_desc->bEndpointAddress;
177
                        emcore_usb_eps_addr.cout = ep_desc->bEndpointAddress;
178
                    break;
178
                    break;
179
                    case 1:
179
                    case 1:
180
                        emcore_usb_eps_addr.cin = ep_desc->bEndpointAddress;
180
                        emcore_usb_eps_addr.cin = ep_desc->bEndpointAddress;