@@ -54,13 +54,14 @@ DEFINE_MUTEX(of_mutex);
5454 */
5555DEFINE_RAW_SPINLOCK (devtree_lock );
5656
57- /*------------------ For ASUS write system-id ---------------------*/
58- static ssize_t asus_write_systemid (struct file * filp , struct kobject * kobj ,
57+ /*-------------------- For ASUS write hwinfo- ---------------------*/
58+ static ssize_t asus_write_hwinfo (struct file * filp , struct kobject * kobj ,
5959 struct bin_attribute * bin_attr , char * buf ,
6060 loff_t offset , size_t count )
6161{
6262 struct property * pp = container_of (bin_attr , struct property , attr );
63- sscanf (buf , "%s" , (char * )pp -> value );
63+ memset ((char * )pp -> value , '\0' , pp -> length );
64+ memcpy ((char * )pp -> value , buf , strlen (buf ));
6465 return count ;
6566}
6667/*----------------------------------------------------------------*/
@@ -162,11 +163,11 @@ int __of_add_property_sysfs(struct device_node *np, struct property *pp)
162163
163164 sysfs_bin_attr_init (& pp -> attr );
164165 pp -> attr .attr .name = safe_name (& np -> kobj , pp -> name );
165- //For ASUS PPID (system-id)
166- if (!(strcmp (pp -> attr .attr .name , "system-id" ))) {
166+ //For ASUS hwinfo
167+ if (!(strcmp (pp -> attr .attr .name , "system-id" ) && strcmp ( pp -> attr . attr . name , "model" ) )) {
167168 pp -> attr .attr .mode = S_IRUGO |S_IWUSR ;
168169 pp -> attr .read = of_node_property_read ;
169- pp -> attr .write = asus_write_systemid ;
170+ pp -> attr .write = asus_write_hwinfo ;
170171 } else {
171172 pp -> attr .attr .mode = secure ? S_IRUSR : S_IRUGO ;
172173 pp -> attr .size = secure ? 0 : pp -> length ;
0 commit comments