/** * Write device file "mode_reactive" * * Sets reactive mode when this file is written to. A speed byte and 3 RGB bytes should be written */ static ssize_t razer_attr_write_mode_reactive(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct usb_interface *intf = to_usb_interface(dev->parent); struct usb_device *usb_dev = interface_to_usbdev(intf); if(count == 4) { unsigned char speed = (unsigned char)buf[0]; razer_set_reactive_mode(usb_dev, (struct razer_rgb*)&buf[1], speed); } return count; }
static ssize_t razer_attr_write_mode_reactive(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct usb_interface *intf = to_usb_interface(dev->parent); //struct razer_kbd_device *widow = usb_get_intfdata(intf); struct usb_device *usb_dev = interface_to_usbdev(intf); struct razer_rgb color; if(count==3) { color.r = buf[0]; color.g = buf[1]; color.b = buf[2]; razer_set_reactive_mode(usb_dev,&color); } return count; }
static ssize_t razer_attr_write_mode_reactive(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct usb_interface *intf = to_usb_interface(dev->parent); //struct razer_kbd_device *widow = usb_get_intfdata(intf); struct usb_device *usb_dev = interface_to_usbdev(intf); //struct razer_rgb color; unsigned char speed; if(count==4) { speed = (unsigned char)buf[0]; //color.r = buf[1]; //color.g = buf[2]; //color.b = buf[3]; //razer_set_reactive_mode(usb_dev,&color,speed); razer_set_reactive_mode(usb_dev,(struct razer_rgb*)&buf[1],speed); } return count; }