Domain controller can’t see me after wakeup

I hibernate my pc’s each night, generally works well.

Woke them up this morning, windows box doesn’t have any synergy mouse/keyboard, can’t log in. after much switching keyboard back and forth between the two, I find windows box can’t resolve linux box by name. The domain controller is happily resolving the windows box, linux can see it, but not vice versa.

Eventually found that if I get linux box to do a smb lookup all of a sudden it reminds the domain controller I’m here and it’ll resolve linux box again no worries. So I’ll now make sure that happens automatically on each wakeup:

# sudo nano -w /etc/pm/sleep.d/wakeup_domain_ping

#!/bin/bash

# I’ve found that sometimes on wakeup the domain controller doens’t realise I’m here…
# so windows box can’t see me by name and therefore doesn’t have any working mouse/keyboard from synergy

case $1 in
suspend|suspend_hybrid|hibernate)
# No need to do anything here
:
;;
resume|thaw)
# “Ping” domain controller
smbclient -L andrewlin
;;
esac

# sudo chmod +x  /etc/pm/sleep.d/wakeup_domain_ping

Happy days.

Streaming system audio from windows to another pc (linux)

So I want to hear what’s going on with my secondary (windows) pc on my headphones (connected to ubuntu).

Get system audio

My onboard realtek 888 does list ‘Stereo Mix’ as a recording option but it was always silent.
So, tried various virtual sound cards, they always either didn’t work/didn’t appear as a recording device, or they just cost more than I want to spend compared to running out and getting a 3.5mm audio cable and looping speaker plug to line-in.

Finally stumbled upon a suggestion: http://www.sevenforums.com/sound-audio/149117-creative-xfi-xtreme-problem.html#post1278957

How to fix Realtek ‘Stereo Mix’ silence? Select Speakers as your default playback device!

Next problem, I can’t select Loudspeaker unless something is plugged into that port because of the port sensing. The Realtek HD Audio Manager on my pc (asus re-branded realtek app) does not have any options to turn off jack sensing, so lets go deeper:
http://thextramoney.wordpress.com/2010/05/16/how-to-disable-jack-detection-on-windows-7/
Regedit -> HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E96C-E325-11CE-BFC1-08002BE10318}\0000\GlobalSettings\EnableDynamicDevices  = 0
And reboot. Still Jack sensing. Kept looking in regedit, the 0000 folder was just one audio driver on the system, the rest of the numbered folders after it (0001, 0002….) were for other drivers that had ever been installed for any sound device. I found another realtek HD one at 0018 and changed the setting there. Reboot. Still wont let me enable Loudspeaker.

Keep hunting…. in:
Regedit -> HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E96C-E325-11CE-BFC1-08002BE10318}\0018\Settings\
there’s a setting ‘JackCtrl’ which I decided to start experimenting with. It was originally set to ” 3f e7 00 00 “. First trial, set to ” ff ff 00 00 ” and reboot. All of a sudden in playback devices I’ve got a “Realtek HD Audio 2nd output”. Looking into it I think it’s the front port, and with the previous setting jack sensing on ti is disabled, so I can select it. That doesn’t help though, as stereo mix still doesn’t get sound.

I eventually give up on finding a software fix, and instead found a short piece of plastic rod, ~ 3mm diameter, and shoved it in the speaker jack. Windows sees it, lets me enable Speakers as playback, job done. Set Speakers as playback default and stereo mix as recording default and we’re ready to stream!

Another option that could be investigated: WASAPI
http://blogs.msdn.com/b/matthew_van_eerde/archive/2008/12/16/sample-wasapi-loopback-capture-record-what-you-hear.aspx
http://naudio.codeplex.com/discussions/203605

Stream the audio

For my initial setup I used Vacard Streamer 2.0 that came with “Vacard 2.b1″. It’ll let me stream from system recording device to a rtp location. Just set the target to rtp://x.x.x.x:4444 where x.x.x is ip or resolvable hostname of linux box. It’ll happily stream as mp3 to reduce bandwidth.

I’ve since switched to using vlc to stream from the pc, started from a batch file.

start /b vlc.exe dshow:// :dshow-vdev=none :dshow-adev=”Line In (High Definition Audio Device)” :dshow-caching=20 :live-caching=50 :sout=#transcode{vcodec=none,acodec=mp3,ab=192,channels=2,samplerate=44100}:rtp{dst=alelec.local,port=5004,mux=ts,sap,name=Radio,ttl=1} :sout-mux-caching=100 :sout-rtp-caching=100 :sout-all :sout-keep

The dshow-adev line is correct for Windows 8, but in Windows 7 I needed it to ba called “Stereo Mix (2- Realtek High Def”

The name can be found initially by running vlc normally and going to file->open capture device

Select the desired audio device in the the drop down box next to Audio Device Name, and then click the “show more options” checkbox down the bottom of the screen. This then gives a printout of the command line name to user.

 

On linux (or mac) box I’ve got vlc running from the console in the background:
# vlc -I telnet –telnet-password vlc rtp://@:5004 –volume 128 &
And it faithfully plays whatever is streamed to it!

Synergy – great software

I’m used to having virtual machines to do multiple os’s, but now at work there’s a spare machine laying around, so on goes linux to use as main pc. This way when windows blue screens as it does far too often, I can keep working on the linux box. Happy Days, higher productivity.

But, I don’t want multiple keyboards/mice.
I also don’t want a physical KVM, expensive, manual process.

Enter Synergy, like having linux in a virtual pc on the second screen, mouse and keyboard moves flawlessly between them.

Went straight to their beta release 1.4.6, works great on Ubuntu 11.4 (as server).
Once installed deb from http://synergy-foss.org/download/
Go ‘One Button’ or ‘Dash Home’ or whatever it’s called, type Startup Applications. Open it. Then ‘Add’, name=synergy, command=synergy, Save. Logout, Login, easy. Should be in the top menu now ans a little grene/blue circle.

On windows-7 x64, I need it as a service or I can’t login (to domain) at boot. Service mode didn’t want to work by default for me, it’d start, conenct, but not mouse/keyboard working.
Use the launcher to put in server settings and hit test button to make sure it works. This did for me. Then use the Autostart button add ‘When Computer Starts’ to install the service.
Read to set all applications in the folder to Administrator (ie right clock, properties -> Compatibility -> Run this program as Administrator) but not sure if that’s really needed.
The main thing that fixed it was changing the service parameters in regedit.

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Synergy Client\Parameters]
“CommandLine”=” –no-daemon –reload –debug DEBUG1 –name MELDSK2006 ANDREWLIN:24800″

Adding the –reload is what fixed it for me. Stop-Start the service in service.msc and it was away!