~ubuntu-branches/ubuntu/vivid/isight-firmware-tools/vivid

« back to all changes in this revision

Viewing changes to src/udev.c

  • Committer: Bazaar Package Importer
  • Author(s): Nobuhiro Iwamatsu
  • Date: 2009-03-04 20:19:36 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090304201936-5accw1ub5r75oaxl
Tags: 1.4.1-1
* New upstream release
  - Remove patches(02_ja-po, 03_support_mba, 05_support_macosx_5.5).
* Update debian/rules
  - Add DEB_CONFIGURE_USER_FLAGS and set "--disable-udev --enable-hal"
* Updated Galician debconf templates. (Closes: #512242)
* Update Japanese po. (06_japanese.po.dpatch)

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
 
47
47
/* OPTIONS */
48
48
static gchar            *firmware       = "isight.fw";
49
 
static const gchar      *USB_BUS        = NULL;
50
 
static const gchar      *USB_DEV        = NULL;
51
49
 
52
50
static GOptionEntry entries[] = {
53
51
        { "firmware", 'f',
56
54
          N_("Path to the firmware."),
57
55
          NULL
58
56
        },
59
 
        { "usb-bus", 'b',
60
 
          0,
61
 
          G_OPTION_ARG_STRING, &USB_BUS,
62
 
          N_("USB bus id"),
63
 
          NULL
64
 
        },
65
 
        { "usb-dev", 'd',
66
 
          0,
67
 
          G_OPTION_ARG_STRING, &USB_DEV,
68
 
          N_("USB device id"),
69
 
          NULL
70
 
        },
71
57
        { NULL }
72
58
};
73
59
 
113
99
                ift_error(_("Unable to read firmware %s."), firmware);
114
100
        }
115
101
 
116
 
        /* DEVICE IDS */
117
 
        /* this is ubuntu/debian specific */
118
 
        USB_BUS = USB_BUS ? USB_BUS : g_getenv("USB_BUS");
119
 
        USB_DEV = USB_DEV ? USB_DEV : g_getenv("USB_DEV");
120
 
 
121
 
        /* this should work everywhere. */
122
 
        if (!USB_BUS || !USB_DEV) {
123
 
                const gchar *device = g_getenv("DEVICE");
124
 
                if (device) {
125
 
                        gchar **parts = g_strsplit(device, "/", 6);
126
 
                        USB_BUS = g_strdup(parts[4]);
127
 
                        USB_DEV = g_strdup(parts[5]);
128
 
                        g_strfreev(parts);
129
 
                }
130
 
        }
131
 
 
132
 
        if (!USB_BUS)
133
 
                ift_error(_("No USB bus id specified"));
134
 
 
135
 
        if (!USB_DEV)
136
 
                ift_error(_("No USB device id specified"));
137
 
 
138
102
        /* init usb */
139
103
        usb_init();
140
104
        if (usb_find_busses() == 0) {
144
108
        }
145
109
 
146
110
 
147
 
        dev = find_usb_device(USB_BUS, USB_DEV);
 
111
        dev = find_usb_product(APPLE_VENDOR_ID,
 
112
                               ISIGHT_PRODUCT_ID);
 
113
 
148
114
        if (!dev)
149
 
                ift_error(_("Device %s:%s not found"), USB_BUS, USB_DEV);
 
115
                ift_error(_("No iSight found"));
150
116
 
151
117
        if (load_firmware(dev, firmware) == -1)
152
 
                ift_error(_("Failed to upload firmware to %s:%s (%x:%x)"),
153
 
                          USB_BUS, USB_DEV,
 
118
                ift_error(_("Failed to upload firmware to 0x%04X:0x%04X"),
154
119
                          dev->descriptor.idVendor,
155
120
                          dev->descriptor.idProduct);
156
121
        else
157
 
                ift_message(_("Firmware loaded succesfully to %s:%s"),
158
 
                            USB_BUS, USB_DEV);
 
122
                ift_message(_("iSight firmware loaded successfully"));
159
123
 
160
124
        closelog();
161
125
 
162
126
        return 0;
163
127
}
164