Lines Matching refs:cbaf
45 * 1. Device plugs, cbaf is loaded, notifications happen.
104 struct cbaf {
132 static int cbaf_check(struct cbaf *cbaf)
135 struct device *dev = &cbaf->usb_iface->dev;
143 cbaf->usb_dev, usb_rcvctrlpipe(cbaf->usb_dev, 0),
146 0, cbaf->usb_iface->cur_altsetting->desc.bInterfaceNumber,
147 cbaf->buffer, cbaf->buffer_size, 1000);
154 assoc_info = cbaf->buffer;
174 itr = cbaf->buffer + sizeof(*assoc_info);
175 top = cbaf->buffer + assoc_size;
247 static int cbaf_send_host_info(struct cbaf *cbaf)
253 hi = cbaf->buffer;
256 hi->CHID = cbaf->chid;
258 strlcpy(hi->HostFriendlyName, cbaf->host_name, CBA_NAME_LEN);
259 name_len = strlen(cbaf->host_name);
263 return usb_control_msg(cbaf->usb_dev, usb_sndctrlpipe(cbaf->usb_dev, 0),
267 cbaf->usb_iface->cur_altsetting->desc.bInterfaceNumber,
278 static int cbaf_cdid_get(struct cbaf *cbaf)
281 struct device *dev = &cbaf->usb_iface->dev;
285 di = cbaf->buffer;
287 cbaf->usb_dev, usb_rcvctrlpipe(cbaf->usb_dev, 0),
290 0x0200, cbaf->usb_iface->cur_altsetting->desc.bInterfaceNumber,
291 di, cbaf->buffer_size, 1000);
304 strlcpy(cbaf->device_name, di->DeviceFriendlyName, CBA_NAME_LEN);
305 cbaf->cdid = di->CDID;
306 cbaf->device_band_groups = le16_to_cpu(di->BandGroups);
316 struct cbaf *cbaf = usb_get_intfdata(iface);
319 ckhdid_printf(pr_chid, sizeof(pr_chid), &cbaf->chid);
329 struct cbaf *cbaf = usb_get_intfdata(iface);
336 &cbaf->chid.data[0] , &cbaf->chid.data[1],
337 &cbaf->chid.data[2] , &cbaf->chid.data[3],
338 &cbaf->chid.data[4] , &cbaf->chid.data[5],
339 &cbaf->chid.data[6] , &cbaf->chid.data[7],
340 &cbaf->chid.data[8] , &cbaf->chid.data[9],
341 &cbaf->chid.data[10], &cbaf->chid.data[11],
342 &cbaf->chid.data[12], &cbaf->chid.data[13],
343 &cbaf->chid.data[14], &cbaf->chid.data[15]);
348 result = cbaf_send_host_info(cbaf);
351 result = cbaf_cdid_get(cbaf);
363 struct cbaf *cbaf = usb_get_intfdata(iface);
365 return scnprintf(buf, PAGE_SIZE, "%s\n", cbaf->host_name);
374 struct cbaf *cbaf = usb_get_intfdata(iface);
376 result = sscanf(buf, "%63s", cbaf->host_name);
390 struct cbaf *cbaf = usb_get_intfdata(iface);
392 return scnprintf(buf, PAGE_SIZE, "0x%04x\n", cbaf->host_band_groups);
401 struct cbaf *cbaf = usb_get_intfdata(iface);
408 cbaf->host_band_groups = band_groups;
429 struct cbaf *cbaf = usb_get_intfdata(iface);
432 ckhdid_printf(pr_cdid, sizeof(pr_cdid), &cbaf->cdid);
442 struct cbaf *cbaf = usb_get_intfdata(iface);
461 cbaf->cdid = cdid;
472 struct cbaf *cbaf = usb_get_intfdata(iface);
474 return scnprintf(buf, PAGE_SIZE, "0x%04x\n", cbaf->device_band_groups);
486 struct cbaf *cbaf = usb_get_intfdata(iface);
488 return scnprintf(buf, PAGE_SIZE, "%s\n", cbaf->device_name);
513 static int cbaf_cc_upload(struct cbaf *cbaf)
516 struct device *dev = &cbaf->usb_iface->dev;
520 ccd = cbaf->buffer;
522 ccd->CHID = cbaf->chid;
523 ccd->CDID = cbaf->cdid;
524 ccd->CK = cbaf->ck;
525 ccd->BandGroups = cpu_to_le16(cbaf->host_band_groups);
532 dev_dbg(dev, " Bandgroups 0x%04x\n", cbaf->host_band_groups);
535 cbaf->usb_dev, usb_sndctrlpipe(cbaf->usb_dev, 0),
538 0x0201, cbaf->usb_iface->cur_altsetting->desc.bInterfaceNumber,
550 struct cbaf *cbaf = usb_get_intfdata(iface);
557 &cbaf->ck.data[0] , &cbaf->ck.data[1],
558 &cbaf->ck.data[2] , &cbaf->ck.data[3],
559 &cbaf->ck.data[4] , &cbaf->ck.data[5],
560 &cbaf->ck.data[6] , &cbaf->ck.data[7],
561 &cbaf->ck.data[8] , &cbaf->ck.data[9],
562 &cbaf->ck.data[10], &cbaf->ck.data[11],
563 &cbaf->ck.data[12], &cbaf->ck.data[13],
564 &cbaf->ck.data[14], &cbaf->ck.data[15]);
568 result = cbaf_cc_upload(cbaf);
595 struct cbaf *cbaf;
599 cbaf = kzalloc(sizeof(*cbaf), GFP_KERNEL);
600 if (cbaf == NULL)
602 cbaf->buffer = kmalloc(512, GFP_KERNEL);
603 if (cbaf->buffer == NULL)
606 cbaf->buffer_size = 512;
607 cbaf->usb_dev = usb_get_dev(interface_to_usbdev(iface));
608 cbaf->usb_iface = usb_get_intf(iface);
609 result = cbaf_check(cbaf);
621 usb_set_intfdata(iface, cbaf);
626 kfree(cbaf->buffer);
628 kfree(cbaf);
635 struct cbaf *cbaf = usb_get_intfdata(iface);
640 kfree(cbaf->buffer);
642 kzfree(cbaf);
652 .name = "wusb-cbaf",