{"id":182,"date":"2017-04-05T13:01:33","date_gmt":"2017-04-05T13:01:33","guid":{"rendered":"http:\/\/simon.aldrich.eu\/blog\/?p=182"},"modified":"2017-04-05T13:01:33","modified_gmt":"2017-04-05T13:01:33","slug":"virtually-unplug-usb-devices-under-linux","status":"publish","type":"post","link":"https:\/\/simon.aldrich.cc\/blog\/2017\/04\/virtually-unplug-usb-devices-under-linux\/","title":{"rendered":"Virtually unplug USB devices under Linux"},"content":{"rendered":"<p>My laptop has a built-in webcam which I don&#8217;t normally want enabled. The immediately obvious solution to this would be to blacklist the usb webcam kernel module (uvcvideo). However, I sometimes want to plug in an external USB webcam and use that. So how do you unplug\/disable a built-in USB device under Linux?<\/p>\n<p>After a bit of poking about it turns out to be possible to do via sysfs, but it&#8217;s a bit fiddly. So I wrote a <a href=\"http:\/\/simon.aldrich.eu\/download\/usbEnableDisable\/usbEnableDisable.sh\">script<\/a> that I can run from rc.local to disable (or enable) a device with a specific vendor and product id.<\/p>\n<p>Example usage:<\/p>\n<pre>$ lsusb\r\n[...]\r\nBus 003 Device 005: ID <span style=\"color: #ff0000;\">04ca:7034<\/span> Lite-On Technology Corp. \r\n[...]\r\nusbEnableDisable.sh <span style=\"color: #ff0000;\">04ca<\/span> <span style=\"color: #ff0000;\">7034<\/span> disable\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>My laptop has a built-in webcam which I don&#8217;t normally want enabled. The immediately obvious solution to this would be to blacklist the usb webcam kernel module (uvcvideo). However, I sometimes want to plug in an external USB webcam and use that. So how do you unplug\/disable a built-in USB device under Linux? After a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":183,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[5,28],"tags":[17,55],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/simon.aldrich.cc\/blog\/wp-content\/uploads\/2017\/04\/Unplugged-USB-Cable.jpg?fit=1980%2C1080&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p2Rw4E-2W","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/simon.aldrich.cc\/blog\/wp-json\/wp\/v2\/posts\/182"}],"collection":[{"href":"https:\/\/simon.aldrich.cc\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/simon.aldrich.cc\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/simon.aldrich.cc\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/simon.aldrich.cc\/blog\/wp-json\/wp\/v2\/comments?post=182"}],"version-history":[{"count":1,"href":"https:\/\/simon.aldrich.cc\/blog\/wp-json\/wp\/v2\/posts\/182\/revisions"}],"predecessor-version":[{"id":184,"href":"https:\/\/simon.aldrich.cc\/blog\/wp-json\/wp\/v2\/posts\/182\/revisions\/184"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/simon.aldrich.cc\/blog\/wp-json\/wp\/v2\/media\/183"}],"wp:attachment":[{"href":"https:\/\/simon.aldrich.cc\/blog\/wp-json\/wp\/v2\/media?parent=182"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/simon.aldrich.cc\/blog\/wp-json\/wp\/v2\/categories?post=182"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/simon.aldrich.cc\/blog\/wp-json\/wp\/v2\/tags?post=182"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}