diff --git a/20160425/chardev-1write.c b/20160425/chardev-1write.c index bd24f069f151a5885f7c94e8ed37ed9c548136c4..12cf5bb5fbd6cac4d64c6ef5f584c6e78c657cef 100644 --- a/20160425/chardev-1write.c +++ b/20160425/chardev-1write.c @@ -27,11 +27,11 @@ static ssize_t device_write(struct file *, const char *, size_t, loff_t *); * Global variables are declared as static, so are global within the file. */ -static int Major; /* Major number assigned to our device driver */ -static int Device_Open = 0; /* Is device open? - * Used to prevent multiple access to device */ -static char msg[BUF_LEN]; /* The msg the device will give when asked */ -static char *msg_Ptr; /* The current char from msg we are writing */ +static int Major; /* Major number assigned to our device driver */ +static int Device_Open = 0; /* Is device open? + * Used to prevent multiple access to device */ +static char msg[BUF_LEN]; /* The msg the device will give when asked */ +static char *msg_Ptr; /* The current char from msg we are writing */ static char msg_username[USERBUF_LEN]; /* User definable name */ static int told_you_counter = 0; /* Counts the outputs I've made */ @@ -194,10 +194,10 @@ device_write(struct file *filp, const char *buff, size_t len, loff_t * off) int i; for(i = 0; i < len; i++) //Save the given string msg_username[i] = buff[i]; - for(i = len; i < USERBUF_LEN; i++) //Zeroing out the rest of mem + for(i = len; i < USERBUF_LEN; i++) //Zeroing the rest of mem msg_username[i] = 0; - printk( KERN_INFO "%s: Successfully got %d bytes!\n", - DEVICE_NAME, (int)len); + //printk(KERN_INFO "%s: Successfully got %d bytes!\n", + // DEVICE_NAME, (int)len); if(msg_username[len-1] == '\n') //Got new line terminator ? msg_username[len-1] = 0; //Then terminate it! return len; //Emit successfully stored len bytes