Bluetooth not really "turning on" on a Sony Vaio VPCEG

599

Solution 1

This is not a fix, but it can solve the problem temporarily.

If you use dual-boot between Ubuntu and Windows, boot to Windows first. Then turn on the hardware switch for wireless.

After that, reboot into Ubuntu. Bluetooth will work now.

Solution 2

I have vaio VPCEG35EN model. I enabled wifi by blacklisting acer_wmi module , but bluetooth is not working even though its always on in windows, and no soft or hard blocking in linux. Morever I doubt bluetooth hardware recognized in linux may not be correct because its an atheros bluetooth not foxconn. anyway here is output from lsusb and rfkill

parijat@UbuntuBook:~$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 003: ID 0c45:64be Microdia 
Bus 001 Device 004: ID 0489:e027 Foxconn / Hon Hai 
parijat@UbuntuBook:~$ rfkill list
0: sony-wifi: Wireless LAN
        Soft blocked: no
        Hard blocked: no
1: sony-bluetooth: Bluetooth
        Soft blocked: no
        Hard blocked: no
2: hci0: Bluetooth
        Soft blocked: no
        Hard blocked: no
3: phy0: Wireless LAN
        Soft blocked: no
        Hard blocked: no

Solution 3

I have a Vaio vpceg too, and I was searching around for answers and discovered that the problem occurs when you wake up the device. As dixonck says, if you reboot into windows, turn Bluetooth off and on and restart without shutting off the laptop, and then enter Ubuntu, you will see that Bluetooth works. However, if you switch off Bluetooth or shut down the laptop, it will not work.

Isn't a Ubuntu issue, is a Linux issue, i have tested it in several distros and it happens in them all.

I think Sony makes a hardblock that completely stops the Bluetooth devices.

Share:
599

Related videos on Youtube

Chaya Cooper
Author by

Chaya Cooper

Updated on September 18, 2022

Comments

  • Chaya Cooper
    Chaya Cooper over 1 year

    I have a number of front-end functions which are triggered based on whether or not a user is signed in (i.e. the menu items displayed), but I'm having trouble triggering them when a user signs in unless they are redirected or the page is refreshed.

    How can I change the value of $logged_in to be set once a user logs in? The functions are all working properly, including setting $_SESSION['SESS_USER_ID'] = $member['user_id']; once they're signed in.

    Index.php (much of this code is also used throughout the site)

    At the beginning of the document:

    <?php    
    require_once('auth.php'); // This file starts session, and checks if(!isset($_SESSION['SESS_USER_ID']) || (trim($_SESSION['SESS_USER_ID']) == ''))  
    require_once('config.php'); // Connects to database connection   
    $user_id = $_SESSION['SESS_USER_ID'];       
    $logged_in = (isset($_SESSION['SESS_USER_ID']));
    ?>
    

    The relevant functions are then triggered by $logged_in, and follow this basic format:

    <?php if ($logged_in) : ?>
    // Some HTML or Script
    <?php else : ?>
    // Some HTML or Script
    <?php endif; ?>
    

    Sign In form & function

    My apologies if some of the AJAX is irrelevant - I don't really know AJAX and re-purposed existing code.

    <form id="loginForm" name="loginForm" action="login-exec_pdo.php"  method="post">  
    <label for="user_name">Username </label><input type="text" name="user_name" required />
    <label for="password">Password </label><input type="text" name="password" required />
    <div id="return_result"></div><div id="messageBox5">Please complete the highlighted    fields</div>                  
    <input type="submit" id="login" value="Sign in" />
    </form>
    
    <script type="text/javascript">
    $(function () { $('#loginForm').validate({          
    rules: {user_name: {required: true, minlength: 2,}, password: {required: true, minlength: 6,},}, messages: {user_name: "", password: "",},      
    errorLabelContainer: "#messageBox5", 
    submitHandler: function (form){
      $.ajax({
        type: 'POST',
        url: 'login-exec_pdo.php',
        data: $("#loginForm").serialize(),
        success: function(data) {   
          if(data == "true") {
            $("#loginForm").fadeOut("fast");
          }
          else {
            writeToTarget('return_result', 'Incorrect Username or Password');
    }  }  });  }   });  });  
    </script>
    

    The login-exec.php file

    <?php
    session_start();
    require_once('config/config_pdo.php'); // Includes db connection, salt, & PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION
    $password = $_POST['password'];  
    $hashedPassword = sha1($salt . $password); 
    
    try {  
       $stmt_user = $conn->prepare("SELECT * FROM customer_info WHERE user_name = :user_name and password = :hashedPassword");  
       $stmt_user->bindValue(':user_name', $_POST['user_name'], PDO::PARAM_STR); 
       $stmt_user->bindValue(':hashedPassword', $hashedPassword);     
       $stmt_user->execute();                 
       session_regenerate_id();                  
       $member = $stmt_user->fetch();                 
       if($member) {                  
          $_SESSION['SESS_USER_ID'] = $member['user_id'];  
          $_SESSION['SESS_USER_NAME'] = $member['user_name'];             
          session_write_close(); 
          echo "true";                 
          exit();
       }else {
          echo "false";
          exit();
       }                    
    }catch(PDOException $e) {
      echo $e->getMessage();
    }                 
    ?>
    

    I've also tried using both javascript and php to set it in the success function within the Sign In function (where indicated above), but it either didn't set it and/or prevented the login function from completing properly. Some of the things I've tried are: if ($logged_in) : $logged_in = (isset($_SESSION['SESS_USER_ID'])); $logged_in = "true"; and $logged_in = 1;

    • Yang
      Yang over 11 years
      one question: ... data: $("#loginForm").serialize() you need to unserialize in PHP the $_POST['data']. Did you do that?
    • Yang
      Yang over 11 years
      oh now I got: you should set $logged_in = true before echo "true"; try this. it should work
    • Chaya Cooper
      Chaya Cooper over 11 years
      @metal_fan: I just tried your suggestion of setting $logged_in = true before echo "true", but unfortunately that's causing it to echo "true" on login-exec.php (instead of keeping the user on the original page)
    • Chaya Cooper
      Chaya Cooper over 11 years
      @metal_fan: I actually repurposed this from another script, so I'm not sure if that's even necessary here because nothing's actually getting posted, it's just being used to select information from the db (I've updated the question to include that query)
    • Yang
      Yang over 11 years
      I'm kinda confused, are you doing AJAX-authorization including form validation, right? The bad thing is that you do not track actions regarding both success and failure, so that it makes a bit harder to figure out what exactly goes wrong...
    • Yang
      Yang over 11 years
      Let me repeat again, that I've noticed so far, you did not unserialization in php right after ..data: $("#loginForm").serialize() ... right?
    • Yang
      Yang over 11 years
      I've just noticed that it's not that hard to break your system... $logged_in isn't really reliable. Why not to create simply class that would handle all this stuff like, $profile->isLogged(), $profile->getUsername() $profile->logout()
    • Chaya Cooper
      Chaya Cooper over 11 years
      @metal_fan: I'm using this jquery validation bassistance.de/jquery-plugins/jquery-plugin-validation to validate that they've entered the required fields (user_name & password), and then the php query checks the db to confirm that the information is correct and to associate this user's session id with their user_id (and it does all that correctly). Just to clarify what you asked about unserializing it in php - I don't, do I need to if I'm specifying $password = $_POST['password']; $hashedPassword = sha1($salt . $password); and I'm binding them in the query?
    • Chaya Cooper
      Chaya Cooper over 11 years
      @metal_fan: I'd love to try your suggestion of creating a class to handle this. Do I put that code in the php where I had $logged_in = (isset($_SESSION['SESS_USER_ID'])); ? Is there anything else that I'd need to do in addition to that?
    • Yang
      Yang over 11 years
      I'm gonna post a very long answer. Which php version do you use?
    • Chaya Cooper
      Chaya Cooper over 11 years
      I'm using version 3.01 on my computer, but my hosting company probably has a more recent version - should I find out which one they use?
    • Yang
      Yang over 11 years
      whaaatttttt!???!!!?? PHP 3.01 Are you sure???!! It's extremely outdated 1998-2001 years (if I remember properly). Please create a dummy script and put this <?php echo PHP_VERSION; ?> What does it tell?
    • Chaya Cooper
      Chaya Cooper over 11 years
      You're totally right - I have v5.2 on my computer :-) (For some reason, the license.txt file listed the version as 3.01 :-( ). And when I added the script and checked it on my site it echo'd 5.2.17 :-)
    • Yang
      Yang over 11 years
      Ok. Before I post an answer, just another question: Do you have some validations for both username and password in PHP ?! or are you totally relying on jquery-validate plugin?
    • Chaya Cooper
      Chaya Cooper over 11 years
      I'm just using the jquery-validate plugin to check that they actually entered something (and generate an error message if they didn't). The php then compares what they've entered to what's in the db to make sure that what they've entered is valid. I was doing that because I find it easier to generate the error messages that way, but if that's a problem I could do the validation in php if necessary
    • pinkpanther
      pinkpanther about 10 years
      can you tell me how you have solved your problem? I'm facing the same problem....
  • m4x1m1l14n
    m4x1m1l14n almost 12 years
    not working here
  • dixoncx
    dixoncx almost 12 years
    What about wi-fi ? It works fine..?
  • dixoncx
    dixoncx almost 12 years
    Can you post output of rfkill list ?
  • m4x1m1l14n
    m4x1m1l14n almost 12 years
    just added rfkill list output to the question's body :]
  • dixoncx
    dixoncx almost 12 years
    Can't find solution yet..:) Can u enable it through sudo hciconfig hci0 up ? Look here: ubuntuforums.org/showthread.php?p=11972551
  • m4x1m1l14n
    m4x1m1l14n almost 12 years
    I receive a timeout error, just like the other people in the forum you pointed. I'm afraid there is no solution.
  • Curtis Mattoon
    Curtis Mattoon over 11 years
    I should add that option #3 won't work if you're showing user-specific data (e.g., "Welcome <?=$user;?>"), but would be fine for something like changing a menu to show "Logout" instead of "Login" and "Register".
  • Chaya Cooper
    Chaya Cooper over 11 years
    Wow! I'm learning so much right now :-D This is going to take me some time to fully understand so I'm 1rst going to try to figure out the part between 'Now, how you should fix this' and 'Tip #1' :-) One thing that I wanted to clarify is that #2 isn't in the HTML template, it's in login-exec.php. What's in the main document is what I referred to as 'The Sign In function' (which passes information back & forth between login-exec.php). Just to be sure I'm being clear, I'll update the code now to include all the relevant pieces. Does that change anything about your approach?
  • Chaya Cooper
    Chaya Cooper over 11 years
    I wasn't sure from your notes if this would still require redirecting users if they log in successfully. My initial intention was intention was to avoid the need for that since they often need to remain on the page that they're on (I hadn't realized that there were other problems with my code, so I'm glad I was trying to do this ;-)). Also, would you mind showing me how to use is_user_logged() to trigger a javascript function too? Some of the functions (i.e. show/hide) would be much simpler to do in js than php, I just couldn't get it to work with my previous method ;-)
  • Yang
    Yang over 11 years
    :) "After they successfully logged in" they should see their own profile page. On failure, they should stay on the current page and get error message, right? If so, there are only two ways to do it: 1) On success, invoke a new ajax call via jquery and then replace entire html tree with ajax response. It would look like so: success: function(respondFromPHP){ $("html").html(respondFromPHP); } 2) And the second approach is just to refresh the page :) basically this is done via winow.location = 'current_page.php' :)
  • Yang
    Yang over 11 years
    :)) oh, yeah, btw, I never said you should invoke UI functions like show()/hide() using PHP. They have nothing to do with a server-side logic. They are merely helpers
  • Chaya Cooper
    Chaya Cooper over 11 years
    No, they're not automatically being redirected on success :-( Most users will remain on the same page until they click on a link. Does that mean that I have to refresh the page?
  • Chaya Cooper
    Chaya Cooper over 11 years
    I haven't made the changes yet :-) I figured I should wait until you saw my 1rst comment (about #2 not being in the main document) to see if that changed anything. I also realized that instead of saying that I was updating the code I should have clarified that I was updating the code in the question ;-) (it now includes the complete script)
  • Chaya Cooper
    Chaya Cooper over 11 years
    I guess what I was wondering about is the format of "if ( TRUE === is_user_logged() ) :", and if I always need to stick to that format. The first time I'd ever seen a similar format was with "if ($logged_in) :", and I didn't understand it enough to be able to modify the script.
  • Chaya Cooper
    Chaya Cooper over 11 years
    I love how simply you laid out the options :-) #3 is actually what I'd been trying to do initially and couldn't get it to work :-D Would you mind showing me how to do that? Also, since it sounds like I may need to do either options 1 or 2, are there any important differences between refresh and retrieve? I know how to refresh (by using window.location in js), but since I don't know how how to retrieve a page in AJAX I figured I should ask :-)
  • Chaya Cooper
    Chaya Cooper over 11 years
    This is actually one of the few forms which I'm submitting via AJAX - most of my forms are submitted entirely in php :-) I'm only using it on the forms where I wanted to use jQuery validation (forms with required fields or email addresses, or if I want to check inline that a username is available). I found it easier for generating validation error messages and I liked some of the user experience that came along with it (and to be honest, the only reason I used AJAX for this is because the clearest tutorial I'd found used it). Would you recommend that I try and change either one of these?
  • Chaya Cooper
    Chaya Cooper over 11 years
    I tried switching data serialize, but that made data always equal false :-( I'm assuming that there's probably a syntax error?
  • Yang
    Yang over 11 years
  • Curtis Mattoon
    Curtis Mattoon over 11 years
    Check this out for a quick example: jsfiddle.net/bF9fB Use the login/logout links to see it in action. Basically, you'd just use .hide() and .show() inside the AJAX success() call. You should return something in your php like "die('authorized')" or "die('error')" so that the AJAX call can determine what the outcome of the PHP script was. (Success is "successful ajax call", not necessarily "successful login"). There are no (for-all-intents-and-purposes) significant differences between #1 and #2, other than how the user perceives the experience.
  • Curtis Mattoon
    Curtis Mattoon over 11 years
    ran out of space.. To load the page through ajax, I've typically done this through an iframe. Refreshing the page may be better (particularly if it's a whole page), but then there's no point in AJAX. You can use jQuery to validate, and do something like $("#myForm').submit(); after a successful validation, and avoid the AJAX altogether. There are some decent plugins for jQuery form validation.. You may want to check out this list: speckyboy.com/2010/06/22/…