Changes in uspace/drv/bus/usb/usbhid/multimedia/multimedia.c [ce2a1c2:2a5b62b] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhid/multimedia/multimedia.c
rce2a1c2 r2a5b62b 161 161 /*----------------------------------------------------------------------------*/ 162 162 163 int usb_multimedia_init(struct usb_hid_dev *hid_dev, void **data) 164 { 165 if (hid_dev == NULL || hid_dev->usb_dev == NULL) { 166 return EINVAL; /*! @todo Other return code? */ 167 } 168 169 usb_log_debug(NAME " Initializing HID/multimedia structure...\n"); 170 163 static int usb_multimedia_create_function(usb_hid_dev_t *hid_dev, 164 usb_multimedia_t *multim_dev) 165 { 171 166 /* Create the exposed function. */ 172 ddf_fun_t *fun = ddf_fun_create( 173 hid_dev->usb_dev->ddf_dev, fun_exposed,NAME);167 ddf_fun_t *fun = ddf_fun_create(hid_dev->usb_dev->ddf_dev, fun_exposed, 168 NAME); 174 169 if (fun == NULL) { 175 170 usb_log_error("Could not create DDF function node.\n"); … … 178 173 179 174 fun->ops = &multimedia_ops; 180 181 usb_multimedia_t *multim_dev = 182 ddf_fun_data_alloc(fun, sizeof(usb_multimedia_t)); 183 if (multim_dev == NULL) { 184 ddf_fun_destroy(fun); 185 return ENOMEM; 186 } 187 188 multim_dev->console_sess = NULL; 189 multim_dev->fun = fun; 190 191 //todo Autorepeat? 175 fun->driver_data = multim_dev; // TODO: maybe change to hid_dev->data 192 176 193 177 int rc = ddf_fun_bind(fun); … … 210 194 return rc; 211 195 } 212 213 /* Save the KBD device structure into the HID device structure. */ 196 multim_dev->fun = fun; 197 198 return EOK; 199 } 200 201 /*----------------------------------------------------------------------------*/ 202 203 int usb_multimedia_init(struct usb_hid_dev *hid_dev, void **data) 204 { 205 if (hid_dev == NULL || hid_dev->usb_dev == NULL) { 206 return EINVAL; /*! @todo Other return code? */ 207 } 208 209 usb_log_debug(NAME " Initializing HID/multimedia structure...\n"); 210 211 usb_multimedia_t *multim_dev = (usb_multimedia_t *)malloc( 212 sizeof(usb_multimedia_t)); 213 if (multim_dev == NULL) { 214 return ENOMEM; 215 } 216 217 multim_dev->console_sess = NULL; 218 219 /*! @todo Autorepeat */ 220 221 // save the KBD device structure into the HID device structure 214 222 *data = multim_dev; 215 223 224 usb_log_debug(NAME " HID/multimedia device structure initialized.\n"); 225 226 int rc = usb_multimedia_create_function(hid_dev, multim_dev); 227 if (rc != EOK) 228 return rc; 229 216 230 usb_log_debug(NAME " HID/multimedia structure initialized.\n"); 231 217 232 return EOK; 218 233 } … … 257 272 258 273 usb_hid_report_field_t *field = usb_hid_report_get_sibling( 259 &hid_dev->report, NULL, path, USB_HID_PATH_COMPARE_END260 | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 274 hid_dev->report, NULL, path, USB_HID_PATH_COMPARE_END 275 | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 261 276 USB_HID_REPORT_TYPE_INPUT); 262 277 … … 278 293 279 294 field = usb_hid_report_get_sibling( 280 &hid_dev->report, field, path, USB_HID_PATH_COMPARE_END295 hid_dev->report, field, path, USB_HID_PATH_COMPARE_END 281 296 | USB_HID_PATH_COMPARE_USAGE_PAGE_ONLY, 282 297 USB_HID_REPORT_TYPE_INPUT);
Note:
See TracChangeset
for help on using the changeset viewer.