Activate/deactivate Wi-Fi on Lenovo B5400 under Ubuntu 14.04

382

Solution 1

A dirty trick worked: I booted the machine in Windows and started the wifi from Fn+F5 combination; note that this works in windows only when HotKey Intergration Driver is installed from lenovo site.

The main question is: what if one gets the laptop w/o Windows, e.g. free dos or linux pre-installed?

Solution 2

You can turn off your wifi using iwconfig.
To do that open a terminal and type the following command:

iwconfig wlan0 down

That should turn off your wifi. To turn it on you can use:

iwconfig wlan0 up

You can also turn it on/off using the wireless settings menu. Go to system setings → network → wireless. There you can turn it on/off. enter image description here enter image description here

Share:
382

Related videos on Youtube

Lorenzo Imperatrice
Author by

Lorenzo Imperatrice

Updated on September 18, 2022

Comments

  • Lorenzo Imperatrice
    Lorenzo Imperatrice over 1 year

    I'm new to C and I would like to know if it's possible to write into a string the character \n from the keyboard by using scanf() function.

    The code that I'm using is this: (sorry for the Italian variables words)

    void riempi_array_stringhe (char* stringhe[], int lunghezza_array)
    {
        for (int i = 0; i < lunghezza_array; i++) {
            stringhe[i] = (char*) malloc(sizeof(char) * 100);
            printf("Insert a new string: ");
            scanf("%s", stringhe[i]);
        }
    }
    

    I tried type shift + enter, alt + enter, or to insert \n as input but not works at all.

    Thanks in advance!

    • tom
      tom about 6 years
      Doubt it can be done, just use getchar() or getch()
    • sinkmanu
      sinkmanu about 6 years
      A little trick is save the string in a file and input it. e.g. python -c 'print "A\nB\nhi"' > foo and ./your program < foo
    • Paul R
      Paul R about 6 years
      ...or even fgets
    • cup
      cup about 6 years
      scanf is an input function: not an output function. You can't write with an input function.
    • Rishal
      Rishal about 6 years
      just press enter
    • Lorenzo Imperatrice
      Lorenzo Imperatrice about 6 years
      This question has a curiosity purpose, so yes, I can even do it like you guys said (that is actually the best way because scanf is dangerous to use), but i was interested in doing this with scanf function.
    • Lorenzo Imperatrice
      Lorenzo Imperatrice about 6 years
      @cup didn't exactly understand what you mean with this
    • Lorenzo Imperatrice
      Lorenzo Imperatrice about 6 years
      @Rishaldevsingh if I just press enter I just say to the program that I finished to input the string.
    • Rishal
      Rishal about 6 years
      what happens when you put '\n' as input in console, is there any error or any kind of output you are able to see
    • Lorenzo Imperatrice
      Lorenzo Imperatrice about 6 years
      @Rishaldevsingh it just write \n in the string
    • tadman
      tadman about 6 years
      Why do people insist on using scanf for everything under the sun? It's not always the best tool, and in fact is often the worst possible tool due to how it can and will wildly overfill buffers.
    • Lorenzo Imperatrice
      Lorenzo Imperatrice about 6 years
      @tadman As I said in a comment before, This question has a curiosity purpose. You're right! scanf is the worst.
  • Lucian Sasu
    Lucian Sasu almost 10 years
    Thanks for your answer. When I press on the on/off button you highlighted in the last picture, the button remains on the off position. Any clue?
  • M.Tarun
    M.Tarun almost 10 years
    please post the output of rfkill list all
  • Lucian Sasu
    Lucian Sasu almost 10 years
    Added as later edit for the question.
  • Lorenzo Imperatrice
    Lorenzo Imperatrice about 6 years
    So the best way is to terminate the string input in a different way, and there is no char (or combination of chars) that can be inserted from keyboard that represent \n in an input right??
  • Andriy Berestovskyy
    Andriy Berestovskyy about 6 years
    @LorenzoImperatrice user can input \n and we can manually substitute it to newline in our code, i.e.: scanf(..., str[i]); str_replace(str[i], "\\n", "\n"); Please note there is no strreplace() in C, so you should google for an example implementation...
  • Lorenzo Imperatrice
    Lorenzo Imperatrice about 6 years
    Thank you very much for the detailed explanation!
  • Jonathan Leffler
    Jonathan Leffler about 6 years
    Note that the %[^EOF] scan set looks for any character except capital-E, capital-O, capital-F — it has nothing to do with EOF except the coincidence that the list of letters is the same. Also note that %[^EOF] will read newlines into the string; indeed, it will keep reading until it crashes, or encounters one of the letters, E, F, O, or it runs into EOF. It won't stop merely because you reach the end of a line.