Recent blog entries for glenn

My problem with reading from a modem is still there. I can't figure out why it's behaving like it is. It's very weird.

You see, when you write ATZ to the modem, it should write back OK, but what I'm getting is, ATZ again.

Xach told me that it could be something about ECHO from the modem, but I'm reasonably sure that I turned that off (unless all the docs I read about serial communications are wrong, or I really messed up bad.)

I'll post the part where I'm having the most trouble

disclaimer** This part of the code is very commented 'cause I've been trying out a million differnt things to get it working.

gchar*
read_from_modem(gint modem_fd, gint chars_to_read)
{
  gchar b_read_from_modem[255];
  gchar *p_read_from_modem;
  gint bytes_read;
  //gint chars_read = 0;
  //#define FALSE 0
  //#define TRUE 1

volatile int STOP=1;

fcntl(modem_fd, F_SETFL, FNDELAY); p_read_from_modem = b_read_from_modem; /* while((bytes_read = read(modem_fd,p_read_from_modem, b_read_from_modem + sizeof(b_read_from_modem) -p_read_from_modem -1 )) > 0) { p_read_from_modem += bytes_read; if(p_read_from_modem[-1] == '\n' || p_read_from_modem[-1] == '\r') break; }

g_print("\n %c \n", p_read_from_modem); */ while (STOP>=1) { /* loop for input */ bytes_read = read(modem_fd,b_read_from_modem,255); /* returns after 5 chars have been input */ //b_read_from_modem[bytes_read]=0; /* so we can printf... */ //printf(":%s:%d\n", b_read_from_modem, bytes_read); //if (b_read_from_modem[0]=='z') STOP=1; STOP = g_strncasecmp(b_read_from_modem,"ATZ",255); //chars_read++; } printf(":%s:%d\n", b_read_from_modem, bytes_read); fcntl(modem_fd, F_SETFL, 0); p_read_from_modem = b_read_from_modem; return(p_read_from_modem); }

oh, and I'll also add the line that tells the modem not to echo stuff back to me.

modem_options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG );

Yes, I did do a tcsetattr(); after that.

Thanks for reading my diary, hope you enjoy my proplems :P

I'm not sure that this is a good way of doing this, but I think I need to reply to jdub's diary entry... you know about 57 ppp thingies.

I'm not really doing this 'cause I feel that if "It's not invented here", I should shun it or something. I'm doing Dull 'cause I want to learn. And to be very perfectly honest, I find it very, very hard to read code, I find it a lot easier to write code than to read it. So that's what I'm doing. I'm writing.

To make things clear, I like jdub, and I'm not offended, I just wanted to say my bit :-)

Hi everyone, this is my second diary entry. I have overcome the bug that I listed yesterday. It was just a matter of g_malloc() etc. Whenever something funny is going on, I guess you can say that it's probably a memory related problem.

Now, I don't have a new bug to post here.. I dunno if I should be happy or sad about that... but anyway, Dull is progressing nicely.. well, not as fast as I want it to go, but it's getting there. I can now access the modem, I haven't been able to read from it though... I'll work on it tonight.

I'm posting this from an internet cafe across the street from my school. I just got out of an exam. I think I'm gonna fail that exam, not that I don't know the stuff that the teacher discussed, it's just that the type of exam that the teacher gave was a very weird multiple choice thingy, wherein two stuff are so similar that it becomes a matter of opinion whether or not it is the right answer :(. The reason why I'm in this internet cafe is because it's even cheaper here than getting internet access from an isp. It only costs about $0.5/hr here, while it costs $1 from an isp to your house. :( I would've gotten the cable modem offer if there was one, but there isn't so, I'm stuck with a 33.6kbps modem.

I'm thinking about the configuration stuff for my app... should I use gconf? or should I just do a plain text thing. A plain text thing would be easier to do, but I wouldn't learn much from it, while gconf may be harder, but it's the future... hmm... I don't know what to do. Do you have a suggestion? e- mail me

God, it's hard to type when you're not on your own keyboard, the spacebar and stuff are smaller... :(

I'm now rambling stuff... perhaps I should just post another diary entry tommorrow..

This is my second day on advogato. And I'm probably going to post every day after this. I shall chronicle my experiences from day to day in trying to learn gtk+ and gnome programming.

In order to learn, I'm going to write a simple app. It's called Dull another ppp dialer for gnome. I don't care if everybody thinks there are too many of those out there.... my problem is that none of them work for me. I'm currently using kppp to connect to the net.

I started on Dull about 2 weeks ago. It's been slow, I have school too, you know. In these two weeks, I have learned/relearned a lot of things about C and gtk+ and Gnome. As of now, Dull is nothing but a little program with a gui, it does nothing yet. It has been fun so far.

The people on #gnome, #gtk+ and #gimp have been really helpful with my stupid questions. some people have really gone out of their way to help me. (whatever, Gs2, more that I can't remember). I am really grateful, specially to whatever.

There were times when I was somewhat flamed or rather talked to in a harsh manner, but that's ok with me, I have learned even from these people.

Right now I'm working on a bug. I hope I can fix this tonight, after school. (I also need to review 'cause it's exam week for me). I'll describe the bug, for anyone who cares to help, just mail me or something.

void
dull_create_log (void)
{
  RsModemWindow *modem_window;

modem_window = create_modem_window(); gtk_widget_set_usize(GTK_WIDGET(modem_window->rs_modem_window),300,350); gtk_widget_show(GTK_WIDGET(modem_window->rs_modem_window));

/*dull_main_connect(GTK_WIDGET(modem_window->rs_txtbox));*/ gtk_signal_connect_object(GTK_OBJECT (modem_window->rs_modem_window), "delete_event", GTK_SIGNAL_FUNC (turn_modem_window_off), GTK_OBJECT(modem_window->rs_modem_window)); }

Now, you see there, the gtk_widget_show() works... but the gtk_signal_connect_object segfaults if I uncomment it... I don't know why, but I'll try to figure it out tonight.

Thanks for reading this. I know it's boring and really worthless for some people... but it is my diary :)

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!