home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / linux / 21412 < prev    next >
Encoding:
Text File  |  1992-12-22  |  2.4 KB  |  79 lines

  1. Path: sparky!uunet!rocket!newshost!nation
  2. From: nation@dopey.sanders.lockheed.com (Robert Nation)
  3. Newsgroups: comp.os.linux
  4. Subject: More on big cursors
  5. Message-ID: <NATION.92Dec22085219@dopey.sanders.lockheed.com>
  6. Date: 22 Dec 92 13:52:19 GMT
  7. Sender: news@rocket.sanders.lockheed.com
  8. Distribution: comp.os.linux
  9. Organization: Lockheed Sanders, Inc.
  10. Lines: 67
  11.  
  12.  
  13. After seeing Ed Carp's (I think) message about wimpy cursors, I
  14. thought that big cursors were just the thing for laptops. It is very
  15. hard to see the underline cursor on an LCD screen. Unfortunately,
  16. I didn't think that patching the kernel was really the best way to fix
  17. the problem, particularly since some of those laptops are 386 sx's and
  18. it takes a year and day to recompile the kernel. So here's a little
  19. program which lets you change your cursor size whenever you feel like
  20. it
  21. #include <unistd.h>
  22. #include <stdlib.h>
  23.  
  24. void outb_p(char value, unsigned short port)
  25. {
  26.   __asm__ __volatile__ ("outb %%al,%%dx"
  27.                         ::"a" ((char)value),"d" ((unsigned short) port));
  28. }
  29.  
  30. main(int argc, char **argv)
  31. {
  32.   unsigned long video_port_reg, video_port_val;
  33.   int val1,val2,top,bottom;
  34.  
  35.   if(argc!=4)
  36.     {
  37.       printf("Usage: %s cons_type top bottom\n",argv[0]);
  38.       printf("cons_type is m for monochrome, c for color or grey-scale\n");
  39.       printf("top is the top row of the cursorwhich is on\n");
  40.       printf("bottom is the bottom row\n");
  41.       printf("Example %s c 0 17 make a block cursor on 80x25 color vga\n",
  42.          argv[0]);
  43.     }
  44.      
  45.   if(argv[1][0]=='c')
  46.     {
  47.       video_port_reg = 0x3d4;
  48.       video_port_val = 0x3d5;
  49.     }
  50.   else
  51.     {
  52.       video_port_reg = 0x3b4;
  53.       video_port_val = 0x3b5;
  54.     }
  55.   top=atoi(argv[2]);
  56.   bottom=atoi(argv[3]);
  57.  
  58.  
  59.   val1=ioperm(video_port_reg,1,1);
  60.  
  61.   val2=ioperm(video_port_val,1,1);
  62.  
  63.   outb_p(10,video_port_reg);
  64.   outb_p(top,video_port_val);
  65.   outb_p(11,video_port_reg);
  66.   outb_p(bottom,video_port_val);
  67. }
  68.  
  69. I called the program cursor_size and put in /bin or /usr/bin. You need
  70. to make it setuid root if you want to be able to use it as a regular
  71. user. I put the line in my rc.local "cursor_size c 0 17" which makes a
  72. full block cursor on an 80x85 color VGA screen. the "c" says to use a
  73. color (or greyscale LCD) screen, instead of a mono screen, for which
  74. you would use "m". 0 and 17 are the cursor extents, in rows.
  75.  
  76.         Hope someone finds this useful,
  77.         Rob Nation
  78.         nation@rocket.sanders.lockheed.com
  79.