I am writing device driver for the first time. DEVICE is initialized properly and appearing in modules list. The problem is that when I write bytes in fd which is made from opening node for device driver. FD returns -1 when i print ret. ret=write(fd,array,size) please suggest the answer. fd=open("node1",O_RDWR); 10 //len=strlen(arr); 11 printf("fd=%d",fd); 12 ret=write(fd,arr,35); 13 printf("ret=%d",ret); 14 printf("writing data= %s",arr); 15 close(fd); 16 return 0; 17 }
Check ur application separately by compiling it as alone application and by passing the file name called node 1 in current directly and check what it returns if it works properly then the problem which r u facing is not in the application it's somewhere in ur device write program.