# Is it possible to change cursor style in console?



## goshanecr (Oct 11, 2016)

Good day!

I like a *_ *cursor instead of block, in console. And in x11 terminals like x11/guake I can change cursor symbol, but in plain console I can't found way to change it. Is it possible?


----------



## T-Daemon (Oct 11, 2016)

In the past this could be done with `vidcontrol -c destructive`, but it is apparently not supported anymore. I am getting:vidcontrol: setting cursor type: Inappropriate ioctl for device.
From vidcontrol(): “Unsupported options lead to error messages, typically including the text "Inappropriate ioctl for device".


----------



## Snurg (Oct 11, 2016)

Go to file vga.c.
Look where the 6845 cursor block start and end registers (see here, Table 2) are being set.
Change the values to your liking.

Edit: To make vga.c work instead of vesa.c, you must also turn off kernel conf setting '`options VESA`'.


----------



## goshanecr (Oct 11, 2016)

Snurg said:


> Go to file vga.c.
> Look where the 6845 cursor block start and end registers (see here, Table 2) are being set.
> Change the values to your liking.
> 
> Edit: To make vga.c work instead of vesa.c, you must also turn off kernel conf setting '`options VESA`'.


I'm see /usr/src/sys/dev/fb/vga.c
And found piece of code in function *vga_set_hw_cursor_shape* as I mean relative to cursor shape:

```
outb(adp->va_crtc_addr, 10);
outb(adp->va_crtc_addr + 1, celsize - base - height);
outb(adp->va_crtc_addr, 11);
outb(adp->va_crtc_addr + 1, celsize - base - 1);
```
But as I'm not strong C-programmer, I don't understand what that code means. I try to propose, that hardware cursor sets up as series of filled lines of char-place on the screen. And that code shows that by default it is a rectangle which formed by filled lines from 1 to height. And if I need a underscore character as cursor, I need to change that piece of code to:

```
outb(adp->va_crtc_addr, 10);
outb(adp->va_crtc_addr + 1, celsize - base - 2);
outb(adp->va_crtc_addr, 11);
outb(adp->va_crtc_addr + 1, celsize - base - 1);
```

Is my discourse are totally nonsense or not?


----------



## Datapanic (Oct 11, 2016)

`vidcontrol -c destructive` will work if you make sc the default for kern.vty in loader.conf.


----------



## T-Daemon (Oct 11, 2016)

Datapanic said:


> `vidcontrol -c destructive` will work if you make sc the default for kern.vty in loader.conf.


I can confirm, the blinking is a little annoying though.


----------



## Snurg (Oct 11, 2016)

goshanecr said:


> Is my discourse are totally nonsense or not?



Not at all.
I'd do the same thing.

If you want a faster blink rate, or no blink at all, consider change bits 5 and 6 setting in the Cursor Start Register also.


----------



## ANOKNUSA (Oct 12, 2016)

Datapanic said:


> `vidcontrol -c destructive` will work if you make sc the default for kern.vty in loader.conf.



Some newer video drivers will not work with sc(4), and booting from UEFI can be problematic. Just bear in mind that vt(4) wasn't made just for fun. It's a replacement for outdated tech.


----------



## SirDice (Oct 12, 2016)

Also note that vt(4) doesn't yet have all the features sc(4) has. There's still a lot of work to be done. 

https://wiki.freebsd.org/Newcons


----------

