L'uso di questo sito
autorizza anche l'uso dei cookie
necessari al suo funzionamento.
(Altre informazioni)
Wednesday, July 27, 2011
Monday, July 18, 2011
Riscoprire Pitigrilli
"Poiché siamo sulla via delle confidenze, riconosco di aver assecondato il teppismo del lettore. Mi spiego: per la strada, quando scoppia un litigio o avviene un incidente della circolazione, scaturisce improvvisamente dalle viscere della terra un individuo che cerca di dare un'ombrellata a uno dei due contendenti, che generalmente è l'automobilista. Il teppista ignoto ha sfogato il suo rancore latente. Così nei libri: il lettore che non ha idee o le ha allo stato amorfo, quando trova una frase pittoresca, fosforescente o esplosiva, se ne innamora, l'adotta, la commenta con un punto esclamativo, con un 'bene!', un 'giusto!', come se egli l'avesse sempre pensata così, e quella frase fosse l'estratto quintessenziale del suo modo di pensare, del suo sistema filosofico. Egli 'prende posizione', come diceva il Duce. Io gli offro il modo di prendere posizione senza scendere nella giungla delle varie letterature." Pitigrilli, "Dizionario Antiballistico"
Così facebook (o con internet), e i suoi stuoli di fanboys.
Così facebook (o con internet), e i suoi stuoli di fanboys.
Rediscovering Pitigrilli
"As I am in a confidential mood, I will acknowledge I have been going along with my reader's hooliganism. Explanation: during every street side discussion, or car accident, a character appears, as if from underground, and tries to hit one of the contendents (generally the car driver) with his umbrella. This unknown hooligan does nothing else then venting his latent aggressiveness. So with books: a reader devoid of ideas (or endowed with rather amorphous ideas) reads a sentence - picturesque, striking, unusual - falls in love with it, takes it in, and comments it with an exclamation mark: 'right on!' 'my feelings exactly!'. It's as if that it had always been his thought, and that sentence the expression of his true inner feelings, his philosophy on the subject. As the Duce used to say, he 'take a position'. I offer the reader a way to 'take a position' without the inconvenience of negotiating the jungle of the various literatures." Pitigrilli, "Dizionario Antiballistico"
So it is with facebook (or the internet) and its flock of fanboys.
So it is with facebook (or the internet) and its flock of fanboys.
Tuesday, July 12, 2011
Xen hotplugging of USB devices in passthrough
Xen's management of USB devices in passthrough (especially for HVM guests, such as windows machines) sucks like a tornado. (kvm's does not shine either, for mostly the same reasons). Among other shortcomings, hotplugging does not work: unplug the device, or turn off your printer, and it disappears - for good. Plugging it in/turning it on will not bring it back into your domU.
The situation can be improved upon using udev rules and a script.
Udev file: /etc/udev/rules.d/99-zlocal:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0951", SYSFS{idProduct}=="1646", \
ENV{idDomU}="mosaico", ENV{idVendor}="0951", ENV{idProduct}="1646",\
RUN+="/usr/local/bin/xen-usb-hotplug mosaico 0951 1646"
(Translation:
if subsystem is usb, vendor 0951 and product 1646 - this numbers can be found with lsusb - put some stuff in the environment and insert a program in the run chain for this event)
The program goes like this::
#!/bin/bash
PROMPT="xen-usb-hotplug(ORION):"
XM=/usr/sbin/xm
logger "${PROMPT} HOTPLUGGING"
logger "${PROMPT} started with environment: $(env)"
DOMU=$1
VENDOR=$2
PRODUCT=$3
#if CLI parameters are unavailable, try to use environment
[[ x${DOMU:=$idDomU} == x ]] && { logger -p user.error "${PROMPT} DOMU is not set"; exit 0 ; }
[[ x${VENDOR:=$idVendor} == x ]] && { logger -p user.error "${PROMPT} VENDOR is not set"; exit 0 ; }
[[ x${PRODUCT:=$idProduct} == x ]] && { logger -p user.error "${PROMPT} PRODUCT is not set"; exit 0 ; }
if [[ x$ACTION != xadd ]]; then
logger "${PROMPT} ${XM} usb-del $DOMU host:${VENDOR}:${PRODUCT}"
${XM} usb-del $DOMU host:${VENDOR}:${PRODUCT}
else
logger "${PROMPT} ${XM} usb-add $DOMU host:${VENDOR}:${PRODUCT}"
${XM} usb-add $DOMU host:${VENDOR}:${PRODUCT}
fi
This sets some service variables, grabs parameters from the CLI, and - if action equals "add", uses "xm usb-add" to stuff the device in the approrpiate domU.
Note that the "remove" part is purely ornamental, because - when unplugged - the device has different information, and the rule is not triggered.
Also note that, to be complete, one would need to discriminate among devices with same vendor and prodID. This is left as an exercise to the reader.
Note: I owe part of what above (essentially the idea of using udev to run a script on usb insertion) to a - since disappeared - blog note by Lorenzo Simionato.
Subscribe to:
Posts (Atom)