Programming :: Driver Dropping Characters / What To Do?
Sep 15, 2010I wrote my hello world type of character device driver.(First driver that I wrote)
I created a device as follows code...
I wrote my hello world type of character device driver.(First driver that I wrote)
I created a device as follows code...
I wrote a small hello world type of character device driver. When I type echo -n "abcdef" > /dev/bond and do a cat /dev/bond then only last "f" of above input abcdef is displayed rest nothing is displayed. I asked this question earlier and some people suggested me some modifications I have done and experimented all that but I am unable to catch the error.
Here is the code
Code:
/* Necessary includes for device drivers */
#include <linux/init.h>
//#include <linux/config.h>
#include <linux/module.h>
[Code].....
Here's the situation: I've got an eee pc 901 running Ubuntu 9.10 netbook remix. I'm using it to connect to a WPA-encrypted wireless network on a WRT54GL running dd-wrt. It mostly connects and works ok, but sometimes it just stops working for no apparent reason (the netbook still shows itself as connected), but you can't get anywhere until you manually disconnect and reconnect. Other times, it will drop the connection, and then quickly reconnect (or sometimes not). Obviously, this behavior is pretty irritating. At first I thought the problem was with the router, but I checked the logs there and they all seem fine, and other computers on the same router don't have this problem. Looking at "dmesg | tail" on my netbook, I see a lot of instances of the following error, which I'm thinking is probably the problem:
Code:
[11137.762233] ERROR!!! RTMPCancelTimer failed, Timer hasn't been initialize!
[11142.872797] ===>rt_ioctl_giwscan. 4(4) BSS returned, data->length = 440
[11152.883274] ===>rt_ioctl_giwscan. 5(5) BSS returned, data->length = 556
[11152.883529] ==>rt_ioctl_siwfreq::SIOCSIWFREQ[cmd=0x8b04] (Channel=11)
[11163.952056] ERROR!!! RTMPCancelTimer failed, Timer hasn't been initialize!
I searched for that error message and I found this Ubuntu bug report: [URL] that describes symptoms that match mine. In that report, a poster mentions that he compiled and installed a new version of the wireless driver from the Ralink website, and it fixed his problem. Do you think installing a new driver would be good? Or has that updated driver already been added to the kernel since that bug report was filed? I've never compiled a kernel module before.
One other thing, I also see repeated instances of these lines (or similar ones) in dmesg, which look like they could be related.
Code:
[44096.275923] RX DESC f30ca000 size = 2048
[44096.276885] <-- RTMPAllocTxRxRingMemory, Status=0
[44096.281404] --> Error 2 opening /etc/Wireless/RT2860STA/RT2860STA.dat
[44096.281424] 1. Phy Mode = 0
[44096.281435] 2. Phy Mode = 0
[44096.309841] 3. Phy Mode = 0
[44096.314533] MCS Set = 00 00 00 00 00
[44096.316196] <==== RTMPInitialize, Status=0
[44096.316280] 0x1300 = 000a4260
[44096.401269] ==>rt_ioctl_siwfreq::SIOCSIWFREQ[cmd=0x8b04] (Channel=11)
[44096.472502] ===>rt_ioctl_giwscan. 1(1) BSS returned, data->length = 116
[44096.472977] ==>rt_ioctl_siwfreq::SIOCSIWFREQ[cmd=0x8b04] (Channel=11)
[44106.768056] ra0: no IPv6 routers present
After doing a clean base install of CentOS 5.3 on a test server, I started having problems with network disconnects. While SSH into the box, I would be intermittently disconnected from the SSH session. At first I thought it was my workstation, but after running ping tests from multiple machines on the network to the test box, it became apparent that the test box was dropping packets. When I lose my SSH connection, the pings also start timing out, for a few seconds, then start again. I increased the console logging and I can see when the ethernet port goes up and down when I physically disconnect the cable, but it does not go down or lose link when the disconnects occur. I changed the NIC ports being used and had the same result. I tried with a different switch with same result. I reinstalled CentOS 5.2 and the problem went away.
Upon further investigation, I found that CentOS 5.2 is using the e1000 driver for my NICs and CentOS 5.3 is using the e1000e driver. I resinstalled CentOS 5.3, and tried using the e1000 driver instead of the e1000e but it no longer detects my NIC's... apparently they moved the support from e1000 to e1000e. I have spent the last 3 days googleing for info on this problem and have not found a solution. Any recommendations? Should I submit a bug report?
[Code]...
As soon as i'm starting to copy a large file enough file (>700Mb) to my ubuntu box (connected to an Asus router via wifi) from a Windows 7 client (connected to router via ethernet cable) i get a dramatic drop in speed. upload starts at 1,0Mb/sec with a ping to ubuntu box at <1ms, and in 2 minutes it drops to 200kb/sec with a ping of over 1000ms! The ping increases with every second in a linear progression.
To exlude router as a possible problem copying to a windows 7 notebook connected to router via wifi results in an average of 2,7Mb/sec with an average ping of 150ms.
MB Model: Asus P5B Deluxe wifi
OS: Ubuntu Server 9.10 + desktop installed
Wifi configured via GUI
2. lsusb
3. wlan0
4. lsmod
I'm working on my ncurses application, written in C. I get user input through a loop which uses getchar(). I was able to recognize Ctrl-n by comparing the keypress to ASCII character 16, and this seems to work fine. However, if I noticed that the ASCII character for Ctrl-j (10) is the same as the Line Feed. I tested this, and if I press enter on the keyboard I get the same ASCII value as when I press Ctrl-j.
So, what do I do if I want Ctrl-j to mean something different in my program than pressing enter?The ncurses terminal mode is set to raw, with a 100 millisecond timeout, and keypad is on (I'm already using the up and down arrow-keys).
I am trying to create an array containing all ASCII characters, how do I create one:
Code:
#!/bin/bash
CHARLIST=( a b c d e f g h i j k l m n o p q r s t u v w x y z
[code]...
I see I'm finally posting an AWK question rather than an answer for a change I wanted to make an AWK script that would scramble all the characters in each field, but leave the first and last characters where they were.
View 14 Replies View RelatedIn a file i have to grep for a particular word and cut 8 characters of that word and replace the last characters with space if it is _1.Eg: HP4350_1..i did grep|cut -c 2-9|but didn't know how to truncate the last two characters if its '_1'.i used tr '[_1] '[ ]'.but it replaced all the characters where there is a 'underscore' and 1 instead of'_1' together.
View 5 Replies View RelatedI'm trying to make a webpage that will display the bash variables I have in a file. These variables are used in a bash script that is run from on my server.The file looks like this:
SERVER=canfs01
SHARE=public
USERNAME=guest
[code]....
I just started using eclipse. Ie, I followed all the instructions to set up C++ and run a simple hello world program.However, I seem to have hit a snag.When I build the solution I get an error. I realized where there should be a > there is a | instead. Every time I type > the | prints instead and I have no idea how to fix this.
View 3 Replies View Relatedsplitting a string by every nth characters. I'm using Python 2.7.1 because I'm using older libraries, if that matters.
For example, if this is my input:
Quote:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ac elit nibh, vitae venenatis ligula. Vestibulum a varius turpis.
Splitting it by every 10th character should produce this list:
Quote:
[ "Lorem ipsu", "m dolor si", "t amet, co", "nsectetur ", "adipiscing", " elit. Sed", " ac elit n", "ibh, vitae", " venenatis", " ligula. V", "estibulum ", "a varius t", "urpis." ]
I wrote a java program that writes strings to a file. The strings contain foreign language characters. When I run the program in Windows, the output file shows the foreign characters. However, when I attempt the same operation in Linux, the output file shows a white question mark in a black background instead of the foreign characters. The same Linux system could display the foreign characters if I copy the output file from Windows to Linux. I tried to create the output file using gedit that my program would then add additional strings to and chose Unicode-32 for encoding but still the same problem.
What could I do to get the program to display the foreign language characters from output text file?
My goal is to send escape characters from Linux to make scanner's LED blink. I've started with a simple "beep" command:
echo -e "�7"
and it worked. We are using WaveLink emulator and the escape sequences for the LED are
echo -e "�33%150;200;5L"
Linux returns me this: 150;200;5L
So, it doesn't work. What am I doing wrong for the LED sequences?
How can I filter ASCII quotes( ' ) and double quotes ( " ) so that I can replace them with the UTF-8 equivalent?If I copy text from a Word Document(ASCII), and upload it to a web page with PHP. The Database(UTF-8) will replace these racters with incorrect character(s).I need some function that will replace these characters but I don't know how to differentiate the ASCII quotes and the UTF-8 Quotes without (somehow) converting the string to hex, then preg_replace'ing the hex code for the symbol.
View 8 Replies View RelatedI am working on an application that will convert English text into equivalent Indian language text. Since Unicode is the standard, I will be using it. In most of the western languages each code-value directly refers to the glyph index and placing the code-values side by side will give the required display. This one to one mapping is not possible in Indian languages where rendering syllables is required rather than rendering just consonants and vowels. Many of the complex characters are made up by combining several unicode values.
My question here is: How Linux renders this Unicode text correctly? More specifically, what package is used? I believe in Windows they use Uniscribe for rendering.I believe there will be an operating system library for handling the text rendering. Or do I need to write my own rendering engine? How programs like Firefox, GEdit shows unicode text? Do they also have proprietary engines for correct rendering?
For example, I have a file called "file" like this one:
type=strongsubj len=1 word=absolve pos=verb stemmed=y priorpolarity=positive
type=strongsubj len=1 word=unique pos=adj stemmed=n priorpolarity=neutral
type=strongsubj len=1 word=absolutely pos=adj stemmed=n priorpolarity=neutral
type=weaksubj len=1 word=taking pos=verb stemmed=y priorpolarity=positive
type=weaksubj len=1 word=friend pos=noun stemmed=n priorpolarity=positive
type=weaksubj len=1 word=usually pos=adverb stemmed=n priorpolarity=positive
type=strongsubj len=1 word=purecolor pos=anypos stemmed=n priorpolarity=negative
type=strongsubj len=1 word=accusingly pos=anypos stemmed=n priorpolarity=negative
I want to add the plural for the noun, for example if find this line:
type=weaksubj len=1 word=friend pos=noun stemmed=n priorpolarity=positive
will add one more line :
type=weaksubj len=1 word=friends pos=noun stemmed=n priorpolarity=positive
where we add "s" for the word friend
I did try to do like that:
<code>
cat file | while read LINE ; do
set -- ${line}
if [[ "${4#pos1=}" == "noun" ]];then
#I tried this line but it doesn't work properly:
v3==$(echo $line |sed 's/$3/$s') #I want to find the third word "word=friend" in that line and add "s" after that word
# I don't know what command to add this new line "$v3" to the file ???
done
</code>
Well, I have a web application in Linux server. All my Java codes are there. FYI, whenever user entered non-ASCII characters(e.g. ∞,�,�) in a text field in my web application, and I check the log of my Java code in Linux server, it returns weird characters.
Suppose user entered ∞ in the text field. I should get ∞ in my log too. However, I got weird characters in return.
I wish to show text between two characters with PHP. Here is some example text:
<p class="abc">My</p>
<table border="1">
<tr><td>name</td><td>is</td></tr>
[code]...
i want to print all ASCII characters kind of like a table, but i really don't have an idea of how to do it, i don't know if there is a built-in method or something to accomplish this, if not
View 2 Replies View RelatedSay I want to write some of the more exotic Unicode characters to a file, what's the proper way to do it? when decimal integers are involved, we use %d for floating point we use %f and for hex we use %p.What's the equivalent marker for Unicode values that C understands?
View 3 Replies View RelatedI am doing a mysql query with a bash shell script like:
mysql translator -u root --password=******** -e "SELECT word FROM tagalog ORDER BY RAND() LIMIT 1" | while read line; do
echo $line
So when I echo the value of $line I get:
word
magandang umaga
"word" is the name of the row in the table and maganda umaga is a randomly selected choice from the row. Is there a way i can remove the name of the row from the variable $line. With a result that will allow me to echo $line and output only the randomly selected entry in from the row e.g. magandang umaga
Okay, so I have a .txt file, LL.txt; here is its contents:
Code:
/mnt/sda1/Music/Lydia Lunch/Honeymoon In Red
/mnt/sda1/Music/Lydia Lunch/Honeymoon In Red
[code]....
I'm having a bit of a headbanger trying to work this one out. I'm trying to remove all of the characters on a line apart from the last 17. For example, I need to change this:
Code:
00000000000000000089;0bbfaeb8
01000000000000000089;0bcb5948
00000000000000000089;0bcc4c40
[code]....
Currently, I'm working on personal project. and I'm kinda stuck. What I want to do is that open a file, and edit that file (deleting unwanted characters). The problem arises after I deleted unwanted characters, the file still has the same length of the original one. Let's assume that we have a file with "1234" in it. I deleted "3" ( I overwrite "\0" ) so now when I check the file, it's 124. But when I check the length, the both have the same size as 4
Here is an example source code
int length, length2;
num = open("a.dat", 2)
length = lseek(num, 0, 2); // Initial length
lseek(num, 2, 0); // editing
write(num, "\0", 1);
length2 = lseek(num, 0, 2); // Final length
close(num);
When I print those values those are exactly the same. Length2 should be one less than length, but the both are 4. What's wrong in m code? Am I supposed to use different character rather than "\0"?
I have a hard time figuring this out. I need to replace the date formats of arrival date(column 31-40) and departure date(column 42-51) and I need 2 outputs. I cannot even figure out how to start.code...
View 6 Replies View RelatedMy problem is to insert one sign like space or ':' into a line or string.The goal is to get a demiliter for `cut`.I tried to do it with `tr A-Z "'A '-'Z '" and such but without success.I guess a while read loop could do it but I don't know howto use it with ` expr length $STR`
View 5 Replies View RelatedI'm working with javascript and trying to replace all instances of a Roman character in a string with nothing. How do I assign var reg to all Roman characters? In UTF8, capital letter A is U0041 and at the other end, small z is UFF5A.
So, I'd like to do something like:
var reg = u0041 - UFF5A;
str1 = str.replace(reg, '');
I think you get the idea. I have no idea if that can be done. The idea is to take this string (for example): str = make a door-to-door[house-to-house] visit / ring every doorbell." And take out all the Roman characters and define it as str1. And then take out all the Korean characters (u1100-uFFDC) and define it as str2. In fact, a WAY more useful thing to do would be to replace the instance of this: [u1100-uFFDC]+" "+[u0041-UFF5A] with [u1100-uFFDC]+","+[u0041-UFF5A] so that the output would be a .csv file.
I would like to replace 'xxxx' with 'yyyy' which is in a file xyz.csproj not sure of what 'xxxx' is, it can be 3055, 4056, 7089 etc. I know it always appears at line # 5 and at character 50.
<Reference Include="System.Management" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Windows.Forms" />
[code]....
After typing "man cut" in my terminal I can't seem to find this answer.
I am trying to write several shell scripts and want to remove the 'lp:<package name>' from the beginning of each line of the output of "bzr ls" as well as any notices at the beginning of the output, leaving only file and folder paths.