Monday 19 October 2020

Random GPU passthru notes

Random GPU passthru notes

Setting up rlimits

if qemu says this:

2020-10-20T03:55:36.078813Z qemu-system-x86_64: -device vfio-pci,host=02:00.0,id=hostdev0,bus=pci.0,addr=0x7,multifunction=on,x-vga=on: VFIO_MAP_DMA failed: Cannot allocate memory

dmesg probably says something like this:

[  147.460769] vfio_pin_pages_remote: RLIMIT_MEMLOCK (65536) exceeded

Add this to /etc/security/limits.conf (at least on gentoo):

dave         hard memlock    20000000

dave         soft memlock    20000000

Giving myself permission to use vfio

I've never found a better way to do this, on boot I execute this to give myself permission to use the correct vfio group that my second video card is in:

    chown dave:dave /dev/vfio/31

Keys getting stuck, mouse jumping randomly 

Only seems to happen when the kbd and mouse are used at the same time. Easiest way to test was to move the mouse while typing in nodepad.  The mouse would jump around and sometimes (not often) a key would get stuck. 

Started happening after I did a full emerge -vup world upgrade (the kernel from 4.13.? to 5.9.1, it had been a while).  Even tried using my old kernel, and old qemu (I saved them before upgrading), still broken.

thanks to: https://www.reddit.com/r/VFIO/comments/824cdi/evdev_passthrough_problem_in_games_keys_get_stuck/

My startup script only had the -object input-linux lines for keyboard and mouse, so I guess it was defaulting to PS/2 devices?  Has been working fine for 3 years.  Installed virtio drivers and added these devices and it was all fine again.
-device virtio-keyboard
-device virtio-mouse

Sound needs to be modules

My monitors use the snd-hda sound driver, so does my computer.  That's 3 snd-hda devices.  When I compile the hda intel/realtek driver in the kernel it claims all three devices.  vfio requires all devices in an iommu group be unbound (so to pass the video card to qemu, the sound card must also be passed, not possible when the kernel has claimed the sound device on the monitor).  echoing something to the /unbind thing just waits forever and never returns.
The way around this is to make a modprobe file to claim the gpu and onboard sound for vfio before the kernel driver can get hold of it.
/etc/modprobe.d/vfio.conf:
options vfio-pci ids=10de:1b81,10de:10f0
softdep snd-hda-intel pre: vfio-pci


Monday 12 August 2019

dbell review review

I posted a review to dbell's website that went over the problems I had.  No surpise, dbell responded with "Thank you for your detailed review. Few of your points are notable and others we couldn’t simply agree. "

They went on to object to each of my points, and I notice my 2/5 stars review has been removed from their website.  

Here are the points in my review, and their response, and my response back to them.  I sent my thoughts back to them but didn't get anything in response.


1. Motion detection is useless – the motion detection is way too sensitive. On the least sensitive setting (or most sensitive, I tried both), on a day with no wind it would push motion alerts at least once minute to my phone. I’m not exaggerating–at least once a minute. The closest thing that could trigger motion it is my neighbour’s tree, 25ft away. So, this device pretty much needs to point at a wall. Tech support said this was a known thing and there was no fix. So I had to turn off motion detection.
dbell: "If you set motion detection sensitivity to 6, it won’t capture 25ft away, value 6 allows max 10ft but motion detection can be improved, we acknowledge that"
me: I tried min and max sensitivity and all values in between.  no change.  I disagree that value 6 captures max 10ft.  That is not consistent with what I experienced.

2. The button sticks. Over the week that it was installed I had six visitors say they rang the doorbell and nothing happened. I had to push very hard on the button to unstick it, leaning into it with my body, and there would be a loud click. Then it worked properly again for about an hour with barely a touch needed to ring the door. Then it would get sticky again. Tech support offered to send me a new dbell, but because of the other issues I decided to return it.
dbell: " We are sorry to hear this – we shipped out 10k+ units, haven’t had a single complaint on stickup button. So it must be our bad luck – you may have received something like that. I haven’t verified your return unit as it went to damaged pile, hard to find it. We do not resell customers return."
me: Ok, I agree it is bad luck, but it still happened to me.  All I can report on is my n=1 sample size. 

3. It can’t actually save clips to a NAS… unless you press a button in the app, assuming the app doesn’t crash first. If you want to save the clip of what happened, or what’s happening, you need to answer the door or motion event in the app and press the record button. If you don’t answer, there is no saved clip. Tech support recommended inserting an SD card to automatically upload to my NAS, however this records continuously, it doesn’t save just the clips of the event.
dbell: "I am not sure which NAS you have. We have tested with QNAP and it saves file in h264 format which VLC can play, need to configure VLC, we have a help topic on that too."
me: My NAS is irrelevant, I mentioned that writing to the NAS wasn't a problem.  Writing only the clips of motion events was the problem.  You either get a constant stream to the NAS (which VLC can't play) or you have to manually initiate recording from within the app.
  
4. It can’t save clips to the SD card either. With the SD inserted, the video is broken into a continuous stream of files which have no header and tech support couldn’t tell me how to play them. So it seems that technically the claim that it can save footage to a NAS or cloud is true.. you either have to manually initiate the recording, or you get a continuous stream in a format that no one knows how to play.
dbell: "Video is not broken into continuous stream. When SD card is formatted it creates 32 blank stream file. But when the video is recorded, it overwrites one of those blank file as one video – video is never truncated in any chunk. So not sure how you are saying that. you can access the video files from app or from the IE browser or any other major browser interface."
me: So the continuous video stream is broken into files, that's what I said.  But the issue wasn't this it's that it's continuous video.  If I'm away and don't answer the motion detection, how do I find the video for it on my NAS.  I have to go through all the video to find the right time index... but I can't even do that because VLC won't play it.  They claim there's a knowledge base entry to play the files on VLC, but the tech I was interacting with didn't know how.

5. I ordered black and they sent a white interior bell. Tech support offered to send a new one of these, but I declined because of the other issues.

dbell: "Black doorbell is shipped with white indoorbell and black indoorbell, we have both options. Some customers like white and some likes black. This was our error and we were happy to replenish with a white one."
me: the website shows black.  This wasn't presented as an option anywhere in the ordering process. 

6. The app crashes frequently and I couldn’t use it to configure the dbell. The app kept complaining that I wasn’t on the same network as the device. I found the (mostly undocumented) web interface and used that to configure the device. After I answered the door two or three times the app would just crash.
dbell: "Which app did you face that? For Android and iOS we get report when the app crash and we continuously fix it. For Android there are over 10k devices, so we are on constant bug fix. For iOS Apple updates the OS and sometimes breaks the app, again we are always patching/fixing the issues. I use the iOS everyday, it will crash once in a while, may be once in a week. So not sure how frequent was yours. It appears your views are sort of more than regular views, for example, you say you couldn’t even configure using the app due to crash – this one is hard to believe as I do configure around 10-12 units each day. So not sure what’s going on here."
me: Again, my experience.  But during the process of configuring the unit I was using the app heavily.  Crashing once a week probably translated into crashing every 10 minutes while setting things up and trying settings.  Also, it crashes once a week under normal use?  That's once a week too many times.

Review on Amazon:

I bought the next version of this doorbell (the dbell HD x2) directly from dbell .  Ultimately I returned it for a refund.  Some of the claims on the website do not match the capabilities of the device (see below).   If you're looking for a device that can send you a notification when someone is at your door and let you talk with them right away, this will work fine.  If you want to do more complicated stuff like motion detection or saving clips to the cloud/home NAS, I can't recommend this product.

1. Motion detection is useless.  The motion detection is way too sensitive.  On the least sensitive setting (or most sensitive, I tried both, and all values in between), on a day with no wind it would push motion alerts at least once a minute to my phone.  I'm not exaggerating.  The closest thing that could trigger it is my neighbour's tree, 25ft away. 

2. The button would stick.  Over the week that it was installed I had six visitors say they rang the doorbell and nothing happened.  Each time the button was stuck.  Maybe I got a bad unit, but it doesn't change that it happened.

3. It can't actually save clips to a NAS... unless you press a button in the app.   If you want to save the clip of what happened, or what's happening, you need to answer the door or motion event in the app and press the record button.  If you don't answer, there is no saved clip. 

4. It can't save clips to the SD card either.  Tech support recommended inserting an SD to automatically upload to the NAS.  And yes, while this does auto-upload to the NAS, it uploads a constant stream to the SD and the NAS (if configured) broken into files.  There is no option to write just clips of events.  

5. The app crashes frequently.  The dbell would not configure from the app, it either kept crashing or threw an error that I wasn't on the same network as the device (I was).  The dbell also has a web interface, mostly undocumented, but I found it and this is how I configured it.  Every 3rd or so time I answered the door within the app it would crash too.




 

Sunday 28 July 2019

dbell Smart Doorbell

I got a dbell x2 (their newest model) in May 2019.   I really wanted to like it, like really really wanted to like it.  It has a unique set of features that sets it apart from other doorbells where paying a monthly fee just to see who is at your door, or who was at your door yesterday has somehow become the norm.  The dbell is designed in Canada and has no subscription fees.  You can pay for cloud storage but since I wasn't going to be using it, I didn't really pay attention to that.  What interested me was that could, according to the website, write clips of motion and visitors directly to my NAS.  This means two things: First, I don't need a subscription or any cloud storage, I can integrate the clip directory with my home automation software to see all the events and footage.  And second, I don't need to use a hack like constantly streaming HD video stream across my home network to monitor the feed to extract motion and doorbell events to collect these clips.

Sadly, the website overstates the capabilities of the device and software, and there are other issues too.  If all you want is a smart doorbell that can push a notification to your phone so you can see who is at your door when they are at your door, this is the doorbell for you.

Here is why it didn't work for me and why I returned it for a refund (minus shipping):

  1. Motion detection is useless - the motion detection is way too sensitive.  Other reviews have said this too, I should have paid more attention.  On the least sensitive setting (or most sensitive, I tried both), on a day with no wind it would push motion alerts once or twice a minute to my phone.  I'm not exaggerating--at least once a minute.  The closest thing that could trigger it is my neighbour's tree, 25ft away.  So, this device pretty much needs to point at a wall.  I wasn't expecting to have to turn off motion detection, which is kind of a dealbreaker.
  2. The button would stick.  Over the week that it was installed I had six visitors say they rang the doorbell and nothing happened.  Each time the button was stuck.  I had to push it very hard to unstick it, leaning into it with my body, and there would be a loud click.  Then it worked properly again for about an hour, with barely a touch needed to ring the door.  Then it would get sticky again.  A doorbell that visitors can't use is also a dealbreaker.  To their credit, they offered to send me a new one, but because of the other issues I decided to return it.
  3. It can't actually save clips to a NAS... unless you press a button in the app.   If you want to save the clip of what happened, or what's happening, you need to answer the door or motion event in the app and press the record button.  If you don't answer, there is no saved clip. 
  4. It can't save clips to the SD card either.  Tech support recommended inserting an SD to automatically uploaded to the NAS.  And yes, while this does make auto-upload work, it causes the dbell  to write  a constant stream to the SD and the NAS (if configured).  There is no option to write just clips of the event.  The stream is broken into a continuous stream of 60MB files which have no header and tech support couldn't tell me how to play them.
  5. I ordered black and they sent a white interior bell, despite black being shown on the website.  They also offered to send a new one of these, but I declined because of the other issues.
  6. The app is broken and crashes frequently.  The dbell would not configure from the app, it either kept crashing or threw an error that I wasn't on the same network as the device.  The dbell also has a web interface, mostly undocumented, but I found it and this is how I configured it.
I contacted their technical support to see about resolving the motion detection and writing clips to the NAS.  They always responded within a day or two so that was great, but it became evident that I was experiencing a device and software limitation, not a configuration problem.  The device just didn't perform as advertised.  I was told that trees are a known problem and there was no way to fix the motion detection, and that I should insert an SD card to automatically capture the video to the NAS (see #4 above, it just records continuously).

Because of the dealbreakers and that I couldn't save clips to my NAS, I eventually asked for a refund.  They said there would be a 30% restocking fee (the website states 20%).  Then they told me that I should have tested the device inside first, before I removed the protective plastic, so they could resell it, and then they would have waived the restocking fee.  I found this a little insulting.   I did test it, but not long enough to figure out that the button would stick, and not to test the sensitivity of the motion detection -- these are things that I just assumed would work.  I also connected it to my NAS and assumed the clip writing thing was just a configuration problem which, because the app kept crashing, I hadn't hit on the right settings yet.

In the end they waived the restocking fee, maybe because I pointed out that the device didn't work as advertised, and also that I'd have to send it back anyway because the button was sticking.   But they did keep the shipping.  So all in all I'm out about $34 because I had to cover the return shipping too.

So now I'm in the market for a smart doorbell again.  Once that has motion detection, and one that will write motion and doorbell events to my NAS without bouncing all the video off the cloud or requiring a subscription fee.




Monday 31 December 2018

Resetting the Page Count on a Samsung Laserjet (MLT-R116 Drum)

Our Samsung M2835 printer's drum unit (MLT-R116, not toner, the drum unit) finally hit its software-programmed end-of-life of 10,000 pages.  This is annoying for several reasons:

  • Page 9,999 was perfectly fine
  • I disagree with business practices involving software-enforced obsolescence 
  • Other printers (Brother and HP) provide an option to reset the page count
After some research, it turns out drum unit uses the same technique as toner cartridges to enforce end-of-life.  It uses a small 4Kbit i2c EEPROM to store the page count.  

There are some great resources for resetting almost the same EEPROM on toner cartridges on Samsung printers.  I used and adapted these to reset the drum counter.

Here's the Chip with contacts soldered to it so I can plug it into my raspberry Pi.





And here's the chip by itself:





And here's the connection to the RPI:



So once connected, dumping and re-writing the ROM is easy.  Use the above links to enable i2c on the RPI and then:

  • python speer.py -b 0x50.bin --addr 0x50
  • python speer.py -b 0x51.bin --addr 0x51
  • bvi 0x50.bin
    • Change offset 0x0C to 00 00 00 00  # See Note Below!
  • python speer.py -r 0x50.bin --addr 0x50
Now the drum counter reports 0 and the printer will print again.  Note: from what I have been reading, some versions of the firmware require modifications to other offsets too.  It's probably easiest to take a snapshot of the eeprom, save it somewhere safe, and then reload the eeprom 5 years later when the page counter is too high.

Note: Thanks to Joe Cooper, you may also, or instead, have to reset bytes of the 0x50.bin starting at 0x26 to 00 00, and at 0x2E to 00 00.    It's possible different printer models/firmware are storing the page count at different offsets.


Tuesday 1 September 2015

First Uber Ride *Updated*

First trip with Uber: driver and trip was great, app and experience was sub-par.

Update: Customer service swings experience to positive agian.

I'd like to think I'd be writing this if all went smoothly, but it didn't, and here we are. Let's start with the positive.  My wife and I were standing outside at Bay and Wellesley, we requested a ride to YYZ, Steve was there within 2 minutes.   It was a pleasant ride.  It was cheaper than a cab, it was cleaner than a cab, it was cheaper than the new train thingy from downtown Toronto to the airport ($30/person, really?), and the subway wasn't running that early anyway.

Now, we did the estimate fare thing, and requested the pickup no less than 5 seconds after that, and ZOMG 1.5x SURGE PRICING!  I'm suspicious that demand rose "through the roof" at 8:30am on a Sunday morning within those 5 seconds, but maybe it was a coincidence, or maybe we were the last grain of sand.  It was still cheaper than a taxi, so we accepted the 1.5x fare.

The night before I added a $20 promo off the first ride.  Everyone said add it, and offered their user-specific codes. I realize now I could have, and should have, added the user-specific code from one of my friends so they get $20 too.  The system accepted the promo code I used.  It knows I'm in Canada.   You can see where this is going.

Three days later it has charged the full amount to my credit card, no promo code.  The promo code still shows up in my account "Enjoy $20 off your first ride" (that's it, no restrictions are visible).   I have a sneaky suspicion that this was a US-only code and the system didn't bother to tell me, or at least warn me.  It would be such a simple thing to do--FYI, you have a Canadian postal code, you just put in a US-only promo.  That's just annoying.

I navigated their help system and entered that the system didn't apply the promo code for the trip.  Now my pessimist is taking over and I expect this to happen:
1. They'll mail me back eventually and tell me it's a US-only code, or had some other restriction the system didn't tell me about.
2. I'll request that they apply it anyway because there was no indication it wouldn't work so they should put $20 back on my card, since that would have been the outcome had I used one of my friend's code (which I can't use anymore because I've taken my first trip).
3. They'll offer a $20 credit.
4. I'll pretty much have no choice to accept, even though I don't see myself using Uber again in the near future.

So feeling a bit taken-advantage-of by the last-second surge pricing and no promo code.  But it was cheaper than a taxi.  A little good customer service right now could turn my feelings around but right now I'm unlikely to use Uber again in the near future.



Update:  No sooner did I finish writing that than Chad from Uber responded with some great customer service.  The code is indeed a US-only code, they put the $20 back on my CC.  







Monday 12 July 2010

Skype + Compiz + Cairo Dock

Apparently skype video has issues with cairo dock.   I can confirm this, it definitely doesn't work, where all other webcam apps (like cheese, or guvcview) work fine.  The recommend solution from skype is to simply turn off all visual effects and compositing.  Just like Adobe recommended all 64bit users switch to a 32bit browser just to use their latest flash player that fixed a rather nasty bug.  It's the "hit it with a big hammer corporate approach".

Thanks to the folks at http://forum.linuxmint.com/viewtopic.php?f=47&t=36236&p=208735 for this one.  Just add "export XLIB_SKIP_ARGB_VISUALS=1"  to /usr/bin/skype and skype.  And it all works.

Saturday 24 October 2009